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?

g.pickardou
  • 28,328
  • 32
  • 103
  • 221

1 Answers1

1

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

http://momentjs.com/

jad-panda
  • 2,439
  • 15
  • 22