iamkun / iamkun/dayjs

_dayjs.default.months is not a function

Open
#2,524 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
48.7k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
I use dayjs.months() it's work in a project, but when I try to test with jest, test failed with TypeError: _dayjs.default.months is not a function

Expected behavior
Expected that test passed, because I couldn't see this error in Chrome log
Can you give advice how to solve this problem or work around?
Information

  • Day.js Version [e.g. v1.10.7]
  • OS: [e.g. Windows 11]
  • Browser [e.g. chrome 119.0.6045.200]
  • Time zone: [e.g. GMT+06:00 DST (Pacific Daylight Time)]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the dayjs.months() call under Jest and compare that setup with the browser case described in the issue. Check whether the reported TypeError is reproducible with the provided information; done means identifying a concrete Jest configuration or usage cause and documenting a verified fix or workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.