iamkun / iamkun/dayjs

Issue with Typescript `import utc from "dayjs/plugin/utc"` gives Cannot find module 'dayjs/plugin/utc' or its corresponding type declarations

Open
#2,831 2 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
I got `Cannot find module 'dayjs/plugin/utc' or its corresponding type declarations` when using Typescript and dayjs latest version.

Image

**Expected behavior**

I fixed this using :
```typescript
import utc from "dayjs/plugin/utc.js";
```
(with .js suffix) but I don't know I'm supposed to do so.

Image

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the TypeScript import failure with the latest Day.js package, then inspect how the utc plugin is exposed and resolved; done when the intended import form works consistently or the required .js suffix is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.