added date format validity check for moment.js usage.