Dayjs: .set doest not work with constructor parser

Created on 27 Sep 2018  路  3Comments  路  Source: iamkun/dayjs

let d = dayjs('2018-09-28')
d.set('hour', 1)
d.set('minute', 2)
console.log(d.toDate())

.set dose not work at all.

All 3 comments

Dayjs is immutable

@paraself

let d = dayjs('2018-09-28')
let a = d.set('hour', 1).set('minute', 2)
console.log(d.toDate())
console.log(a.toDate())

Thanks guys, I did not realize Dayjs is immutable .;D

Was this page helpful?
0 / 5 - 0 ratings