Skip to content

gggg not working correctly #1304

Closed
backstage/backstage
#4967
@maxsimych

Description

@maxsimych

Describe the bug
gggg not returns week year, but just a year
The same functionality in moment js works correctly

const dayjs = require('dayjs');
const moment = require('moment')
const weekOfYear = require('dayjs/plugin/weekOfYear');
const weekYear = require('dayjs/plugin/weekYear');
const advancedFormat = require('dayjs/plugin/advancedFormat');
require('dayjs/locale/en-gb')
dayjs.locale('en-gb')

dayjs.extend(weekYear)
dayjs.extend(weekOfYear)
dayjs.extend(advancedFormat)
console.log(dayjs().toString())
console.log(dayjs().format('gggg-ww'))
console.log(moment().locale('en-gb').format('gggg-ww'))

Expected behavior
Sun, 03 Jan 2021 20:38:27 GMT
2020-53
2020-53

Result
Sun, 03 Jan 2021 20:38:27 GMT
2021-53
2020-53

Information

  • Day.js Version 1.10.1
  • OS: linux
  • Browser chrome 87
  • Time zone: UTC+3 (Europe/Moscow)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions