Created
July 27, 2015 19:17
-
-
Save renatocron/8c956f8545a2c4095e0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use DateTime::Format::Pg; | |
subtype DataStr, as Str, where { | |
eval { DateTime::Format::Pg->parse_datetime($_)->datetime }; | |
return $@ eq ''; | |
}, message { "invalid date [$_]" }; | |
coerce DataStr, from Str, via { | |
DateTime::Format::Pg->parse_datetime($_)->datetime; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment