[v1] date.isValid(val, 'DD/MM/YYYY') ??



  • There is any way to check if a date of a different locale is valid using Date Utils without having to decompose it to a YYYY/MM/DD string?

    Suggestion 1: Cant functions like isValid take a second mask parameter to indicate the valid input format?

    Suggestion 2: Date Utils could have a “setLocale” function to make all of its functions handle date format accordingly.

    Thanks!



  • @labs20 1. you can use date.extractDate first then date.isValid date.isValid(date.extractDate('yourDateString', 'locale')) https://quasar.dev/quasar-utils/date-utils#Extract-Date.
    2. date utils is not a class, you can compose one though and import the quasar date utils in it, using its functions to shape functionalities according to your needs.



  • @metalsadman Thanks for your reply!

    Yes, the double function combo is what I was doing, it just looks more concise IMHO to have a second parameter and keep things simpler.

    Thanks for you help!


Log in to reply