dayjs().format('YYYY w Week') error result

Created on 17 Sep 2019  ·  5Comments  ·  Source: iamkun/dayjs

Describe the bug
使用dayjs().format('YYYY年第w周') 期望可以得到 2019年第29周

Expected behavior
使用dayjs().format('YYYY年第w周') 期望可以得到 2019年第29周,实际上却展示为2019年第w周

Information

  • Day.js 版本1.8.16
  • OS: Linux
  • Browser chrome 74.0.3729.131
  • Time zone: GMT+08:00
released ☢️Bug

Most helpful comment

@sam019

'gggg' is already supported in advancedFormat plugin (and depend on weekYear plugin)

dayjs.extend(weekYear)
dayjs.extend(advancedFormat)

dayjs().format('gggg')

All 5 comments

Bug confirmed.

Current workaround

var dayjs = require("dayjs")
var advancedFormat = require('dayjs/plugin/advancedFormat')
var weekOfYear = require('dayjs/plugin/weekOfYear')

dayjs.extend(advancedFormat)
dayjs.extend(weekOfYear)


dayjs().format('YYYY年第wo周')

@iamkun hello, i also find dayjs().format('gggg')not working, but momentjs support it. expect dayjs support it

@sam019

'gggg' is already supported in advancedFormat plugin (and depend on weekYear plugin)

dayjs.extend(weekYear)
dayjs.extend(advancedFormat)

dayjs().format('gggg')

@sam019

'gggg' is already supported in advancedFormat plugin (and depend on weekYear plugin)

dayjs.extend(weekYear)
dayjs.extend(advancedFormat)

dayjs().format('gggg')

ok thanks~

:tada: This issue has been resolved in version 1.8.17 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings