javascript - I want to automatically format the date when entering numbers. The formatted date is: YYYY-MM-DD
伊谢尔伦2017-07-05 10:50:15
0
6
1080
I want to write a component that automatically formats the date when inputting numbers, such as: 201705. The final date format is: 2017-05. Enter 06 again to automatically format 2017-05-06
Edit: Simple conversion of the proposed case:
A simple implementation is as follows:
You maybe need momentjs
Native
Isn’t it bad?