iamkun / iamkun/dayjs

Dayjs: r.ordinal is not a function at advanceFormat.js

Open
#1,891 16 comments 3 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**
When I try to format the date to show ordinal for date it breaks the app and shows error r.ordinal is not a function.
Code:
import dayjs from 'dayjs';
import advancedFormat from 'dayjs/plugin/advancedFormat';
dayjs.extend(advancedFormat);
const formattedDate = dayjs(endDate).format("MMMM Do, YYYY");

**Expected behavior**
It should format date in this format => December 31st, 2022

**Information**
- Day.js Version [1.10.7]
- OS: [iOS]
- Browser [chrome [100.0.4896.127]]
![Screenshot (116)](https://user-images.githubusercontent.com/48604070/167511387-a73a09f3-7094-4694-b642-298a642672fb.png)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the error with the advancedFormat plugin and the `dayjs(endDate).format("MMMM Do, YYYY")` call described in the issue. Inspect the advancedFormat.js path mentioned in the title; done means the call no longer throws and produces the expected December 31st, 2022 format.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.