Looking to validate a date in string format using moment JS, I am encountering an issue.
Using the dd/mm/yy
format in pCalendar in ngPrime, I store the date value in stDate
.
Here is the code I have written:
var stDate = '02/02/2021';
var stDateMoment = moment(stDate, 'dd/mm/yy');
I'm puzzled as to why the expression
stDateMoment.isValid()
is returning a false value.
Any insights or suggestions on what might be causing this?
Appreciate your help!