dayjs returns wrong object when created using year week string YYYY-w

Created on 11 Aug 2020  路  2Comments  路  Source: iamkun/dayjs

Describe the bug
When creating dayjs object from year week string such as 2020-35, the created object contains the wrong month and date information.

For example:

dayjs('2020-35', 'YYYY-w'). //Wed Jan 01 2020 00:00:00
dayjs('2020-35', 'YYYY-w').format('YYYY-w'). //2020-1

Expected behavior
dayjs should return the right object.

Information

  • Day.js Version 1.8.33
  • OS: macos
  • Browser chrome84
  • Time zone: GMT+08:00

Most helpful comment

Day.js does not support parsing w token but will add it in the future.

List of all available parsing tokens https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens

All 2 comments

Day.js does not support parsing w token but will add it in the future.

List of all available parsing tokens https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens

any progress?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dakshshah96 picture dakshshah96  路  5Comments

Sunrise1970 picture Sunrise1970  路  4Comments

g1eny0ung picture g1eny0ung  路  4Comments

idasbiste picture idasbiste  路  4Comments

ljmerza picture ljmerza  路  3Comments