Commits

Toby Inkster committed 8d25cb8

bugfix for dt types

Comments (0)

Files changed (1)

 	{
 		my $var = $_[1];
 		my @code;
-		push @code, "do {";
+		push @code, "do { my \$ok = 1;";
 		push @code, sprintf(
-			'my (%s) = (%s =~ $Types::XSD::dtarr[%d]);',
+			'my (%s) = (%s =~ $Types::XSD::dtarr[%d]) or --$ok;',
 			join(', ', map "\$$_", @fields),
 			$var,
 			$j,
 		);
 		push @code, sprintf(
-			'eval { "DateTime::Incomplete"->new(%s)->to_datetime(base => $Types::XSD::base_datetime) };',
+			'$ok and eval { "DateTime::Incomplete"->new(%s)->to_datetime(base => $Types::XSD::base_datetime) };',
 			join(', ', map "$_ => \$$_", @fields),
 		);
 		push @code, "}";
 ];
 
 facet qw( pattern whiteSpace enumeration maxInclusiveDuration maxExclusiveDuration minInclusiveDuration minExclusiveDuration ),
-declare YearMonthDuration, as Duration[ pattern => qr{^[^DT]*$} ];
+declare YearMonthDuration, as Duration->parameterize(pattern => qr{^[^DT]*$});
 
 facet qw( pattern whiteSpace enumeration maxInclusiveDuration maxExclusiveDuration minInclusiveDuration minExclusiveDuration ),
-declare DayTimeDuration, as Duration[ pattern => qr{^[^YM]*[DT].*$} ];
+declare DayTimeDuration, as Duration->parameterize(pattern => qr{^[^YM]*[DT].*$});
 
 dt_maker(
 	DateTime => qr{^