Giter Site home page Giter Site logo

Comments (6)

autarch avatar autarch commented on August 23, 2024 1

#123

from datetime.pm.

autarch avatar autarch commented on August 23, 2024

Yes, I think this would be possible. We'd need to check that @_ == 1 and that $_[0] is a valid Num. Are you up for writing a PR?

from datetime.pm.

neilb avatar neilb commented on August 23, 2024

Are you up for writing a PR?

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 from_epoch with its validation etc, and remembering there are other options allowed, so it's not such a quick fix, for me at least.

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.

from datetime.pm.

danstewart avatar danstewart commented on August 23, 2024

@autarch I've had a look at this but can't figure out how to validate with Params::ValidationCompiler, any pointers?

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?

from datetime.pm.

autarch avatar autarch commented on August 23, 2024

Added in 1.56

from datetime.pm.

neilb avatar neilb commented on August 23, 2024

Yay! Thanks.

from datetime.pm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.