Home > Mobile >  How to set the default format in dayjs?
How to set the default format in dayjs?

Time:06-20

I want set "YYYY-MM-DD HH:mm:ss" to the default format to avoid unnecessary code like:

this.dayjs().startOf("year").format("YYYY-MM-DD HH:mm:ss")
this.dayjs().format("YYYY-MM-DD HH:mm:ss")
this.dayjs().startOf("week").format("YYYY-MM-DD HH:mm:ss")

CodePudding user response:

Try adding the below to App.vue,

created() {
  this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
}

CodePudding user response:

I found the article about dayjs, and maybe it can help you. You can read in link below

  1. Format
  2. Customize
  3. String Format
  • Related