class X::Temporal::InvalidFormat
Error ReportCollection examples

Error due to using an invalid format when creating a DateTime or Date

class X::Temporal::InvalidFormat does X::Temporal is Exception { }

This exception is thrown when code tries to create a DateTime or Date object using an invalid format.

my $dt = Date.new("12/25/2015");
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::Temporal::InvalidFormat: Invalid Date string '12/25/2015'; use yyyy-mm-dd instead␤» 


method invalid-str

Returns the invalid format string (12/25/2015 in the example above)

method target

Returns the target type (Date in the example above)

method format

Returns valid format strings for the target type in question, (yyyy-mm-dd in the example above)