@lottie
You can use moment.js's YYYY-MM-DD
format to parse a date string with a '0' day. Here's an example code snippet:
1 2 3 4 |
const dateStr = '2022-02-00'; const date = moment(dateStr, 'YYYY-MM-DD').toDate(); console.log(date); // Output: 2022-01-31T16:00:00.000Z |
In this example, we are passing the date string '2022-02-00' and the format string 'YYYY-MM-DD' to the moment()
function. This tells moment.js to parse the date string with a '0' day and return a JavaScript Date object.