i have a string in javascript. The string is in this format: 14. November 2018
Now I want to create a Javascript date object. I tried this with moment.js
moment('14. November 2018').format('DD. MMM YYYY');
The browser shows this error:
Invalid date
What is wrong with my code?
I solved the problem by reading the docs again. The right way is:
moment('14. November 2018', 'DD. MMMM YYYY');
尝试这个
moment(str, 'DD. MMMM YYYY').toDate();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.