I am programming a facebook chat bot and I receive the date and time from the user, I want to create an object of type Date().
Accepted formats from user:
Date:
15.9.2017
15/9/2017
15/09/2017
15.09.2017
Time:
15:30 et
15:30
3pm et
3pm
Would you recommend me some library (I've looked at moment.js)? How would you parse these formats?
EDIT
For Time validation I use this regex:
/((0?[0-9]{1,2} ?(pm|am) ?(et|at)?)|(0?[0-9]{1,2}:0?[0-9]{1,2} ?(pm) ?(et|at)?)|(0?[0-9]{1,2}:0?[0-9]{1,2} ?(et|at)?))/
For Date validation I use this regex:
/(0?[1-9]|[12][0-9]|3[01])[\/\-\.](0?[1-9]|1[012])[\/\-\.]\d{4}/