iamkun / iamkun/dayjs

dayjs.extend is not a function

Open
#2,879 8 comments 1 reaction 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**
when we called the dayjs extend function its showing as not a function.

`import * as dayjs from 'dayjs';
import * as relativeTime from 'dayjs/plugin/relativeTime.js';

dayjs.extend(relativeTime);`

![Image](https://github.com/user-attachments/assets/ff1413db-e2fd-4a80-9afd-6d2129dd063f)

When we are changing import method as below showing error as

`import dayjs from 'dayjs'`

![Image](https://github.com/user-attachments/assets/691a1e97-bef4-4dc8-a8a6-5db03ccd952a)

we tried to update the tsconfig.json with below properties. still facing the same issue.

`"esModuleInterop": true,
"allowSyntheticDefaultImports": true,`

**Information**
- Day.js Version [e.g. v1.11.13.]
- OS: [e.g. Windows]
- Browser [e.g. chrome 62]
- Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.