dayjs
dayjs copied to clipboard
Format breaks on React Native
Describe the bug
Dayjs breaks react native when I call the format method e.g:
import dayjs from "dayjs";
dayjs().format("ddd MMM D, YYYY")
I get this error:
undefined is not an object evaluating ('i[n]')
Expected behavior
Dayjs should format date e.g Wed Jul 27, 2022
Information
- Day.js Version [e.g. v1.11.4]
- OS: [iOS and Android]
- Browser [e.g. chrome 62]
- Time zone: [GMT+01:00 WAT]
I think your code works fine, pls check the func which mention it ( or can you provide it here )

I use it to display a text like so
import dayjs from "dayjs";
...
<Text>dayjs(time?.dateTime).format("hh:mm A")</Text>
...
When I use moment, it doesn't break the app and the text is displayed
import moment from "moment";
...
<Text>moment(time?.dateTime).format("hh:mm A")</Text>
...
The value time is a prop I am receiving and it's always defined.
This is the error that gets thrown when I try to invoke dayjs:

I created a demo CodeSandbox and it runs without error - strange 😄
Cross-referencing with:
https://github.com/iamkun/dayjs/issues/1377
Timezone support seems broken with React-Native Hermes/Intl. Has anyone got this to work?