dayjs__WEBPACK_IMPORTED_MODULE_5
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I am trying this in a React project (JS not TS) and it does not work. I get the error `TypeError: dayjs__WEBPACK_IMPORTED_MODULE_5___default.a.unix(...).utc is not a function`
My code is:
`import dayjs from "dayjs";`
`export const unixToDate = (unix, format = "YYYY-MM-DD") => { return dayjs.unix(unix).utc().format(format); };`
**Expected behavior**
I should get dates in the specified format by sending timestamps.
**Information**
- Day.js Version [e.g. v1.10.4]
- OS: macOS
- Browser: Chrome v100.0.4896.127
- Time zone: IST
Contributor guide
Research direction
Start by reproducing the reported React JavaScript example using the supplied dayjs.unix(...).utc().format(...) call and the stated browser environment. Check how the UTC functionality is made available and verify that the result matches the requested date format. Done means the example runs without the reported TypeError and returns the expected formatted date.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100