Home > Mobile >  Vue js change attribute date format
Vue js change attribute date format

Time:02-23

I have an object in vue js retrieved from form with attribute date and a value 22-02-2022. How can I change this value to be 2022-02-22?

CodePudding user response:

  1. you can implement a conversion function yourself, as the problem, it is not difficult
  2. you can add a new library like enter image description here

    CodePudding user response:

    You can turn value into array and reverse them

    let str = '22-02-2022'.split("-").reverse().join("-");
    console.log(str);
    
  • Related