Commits

Toby Inkster committed 8d55141

YearMonthDuration and DayTimeDuration

Comments (0)

Files changed (1)

 	(length($str) * 3 / 4) - $padding;
 }
 
-our @patterns; my $pattern_i = -1;
+our @patterns;   my $pattern_i = -1;
 my %facets = (
 	length => sub {
 		my ($o, $var) = @_;
 	NonNegativeInteger PositiveInteger UnsignedLong UnsignedInt
 	UnsignedShort UnsignedByte Duration DateTime Time Date GYearMonth
 	GYear GMonthDay GDay GMonth
-	DateTimeStamp
+	DateTimeStamp YearMonthDuration DayTimeDuration
 );
 
 our @EXPORT_OK = qw( dt_cmp dur_cmp dt_parse dur_parse );
 	$}xism
 ];
 
+facet qw( pattern whiteSpace enumeration maxInclusiveDuration maxExclusiveDuration minInclusiveDuration minExclusiveDuration ),
+declare YearMonthDuration, as Duration[ pattern => qr{^[^DT]*$} ];
+
+facet qw( pattern whiteSpace enumeration maxInclusiveDuration maxExclusiveDuration minInclusiveDuration minExclusiveDuration ),
+declare DayTimeDuration, as Duration[ pattern => qr{^[^YM]*[DT].*$} ];
+
 dt_maker(
 	DateTime => qr{^
 		(-?[0-9]{4,})