时间工具之“js初始化当前时间数据”

⑨前端:初始化当前时间数据

方案一(峰哥认可)

// 2023-02
this.$moment().format('yyyy-MM'),

// 2023-02-02
this.$moment().format('yyyy-MM-dd'),

 

 

方案二(原始)

// 2023-2
yearMonth: new Date().getUTCFullYear().toString() + "-" +(new Date().getMonth() + 1).toString(),
 

 

 

posted @ 2023-02-02 09:59  骚哥  阅读(120)  评论(0编辑  收藏  举报