-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have from_epoch() support just getting seconds passed #119
Comments
Yes, I think this would be possible. We'd need to check that |
My first thought was "yeah", that should be easy — as you say,we just need to check @_ and valid number. How hard can that be? Then I looked at the code for I've put it on my perl todo list, but TBH there are a lot of things ahead of it, so realistically not likely to happen any time soon, sadly. |
@autarch I've had a look at this but can't figure out how to validate with This seems to work: my %p = $_[0] =~ /^\d+$/ ? ( epoch => $_[0] ) : $validator->(@_); Is there a smart way to work this into the current validator that I'm missing, or is it possible to have the validator not die, then I could use two separate validators? |
Added in 1.56 |
Yay! Thanks. |
It feels like more often than not, when I have epoch seconds and want a DateTime,
I write something like this:
Then I get the error message, say "D'oh!", and add the
epoch =>
The
"epoch"
parameter feels redundant, and I can't be the only one who does this? How about supporting both styles?The text was updated successfully, but these errors were encountered: