0

I found many custom format validation questions and answers, however all's format was a specific hardcoded format. I would like to allow to set date and datetime format as (runtime) "setting" in my web application so it will dynamic at runtime. I would like to validate the user input against this setting:

isValidDate(userInput, currentSetting)

the content for currentSetting variable could be for example: mm/dd/yyyy

or yyyy.MM.dd HH:mm:ss (for date time)

I do not want reinvent the wheel, but I did not found such an universal parse/validate method. Missed I something?

1

1 Answer 1

1

You can use momentjs. it provides all kind of time/date related functions

http://momentjs.com/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.