dayjs().format('x') result output x characters
Describe the bug
Regarding the function of format('x'), the results obtained are inconsistent with expectations.
dayjs('2023-09-01T08:12:16.468+00:00').format('x')
output:x
dayjs('2020-03-25T02:53:51.259Z')
output:{$L: 'en', $d: Wed Mar 25 2020 10:53:51 GMT+0800 (中国标准时间), $x: {…}, $y: 2020, $M: 2, …}
dayjs('2020-03-25T02:53:51.259Z').format('x')
output:x
Expected behavior
Unix Timestamp in millisecond
Information Day.js Version [1.11.9] OS: [Mac OS 13.4] Browser [Chrome Version 116.0.5845.110] Time zone: [GMT +2]
You need to add the advancedFormat plugin https://day.js.org/docs/en/plugin/advanced-format
var advancedFormat = require('dayjs/plugin/advancedFormat')
dayjs.extend(advancedFormat)
dayjs('2023-09-01T08:12:16.468+00:00').format('x')
You need to add the advancedFormat plugin https://day.js.org/docs/en/plugin/advanced-format
var advancedFormat = require('dayjs/plugin/advancedFormat') dayjs.extend(advancedFormat) dayjs('2023-09-01T08:12:16.468+00:00').format('x')
I have the same issue, I added the plugin but the result didn't change