Cannot set property '$timezone' of undefined
See original GitHub issueException:
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
TypeError: Cannot set property '$timezone' of undefined
at M.f.tz (/root/v3/node_modules/dayjs/plugin/timezone.js:1:1271)
at Function.withdrawalCompleted (/root/v3/dist/core/common/utils/TelegramNotification.js:31:54)
at EventEmitter.<anonymous> (/root/v3/dist/core/withdrawal/services/status.service.js:124:63)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Code (withdrawalCompleted):
import * as DayJS from 'dayjs'
import * as DayJSTimezone from 'dayjs/plugin/timezone'
DayJS.extend(DayJSTimezone)
export class Notification {
public static async withdrawalCompleted(withdrawal) {
const dateText = DayJS(withdrawal.createdAt).tz('Europe/Moscow').format('dd.LL.yyyy HH:mm:ss ZZZZ')
...
}
}
Details:
node v16.5.0
npm v7.19.1
dayjs v1.10.6
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Using of "dayjs/plugin/timezone" causes Uncaught TypeError
Using of "dayjs/plugin/timezone" causes Uncaught TypeError: Cannot set property of undefined.
Read more >Cannot read property 'setDefault' of undefined in momentjs ...
javascript - TypeError: Cannot read property 'setDefault' of undefined in momentjs,, moment.tz() - Stack Overflow. Stack Overflow for Teams – ...
Read more >Cannot read property 'timezone' of undefined - Help me!
Hello, I have an issue using the smart actions, I got this error message “Unexpected error with Valider action”.
Read more >Set Default Timezone
Change default timezone from local time zone to your custom timezone. You can still custom a different timezone in a specific dayjs object....
Read more >Guides - Moment.js
please create an issue or make a pull request in the momentjs.com repository. ... In particular if Moment TimeZone is in use, this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ok, Timezone plugin depends on Utc, don’t forget to add it as well !
First of all, please extend UTC plugin first
Second, if you still facing some trouble, feel free to reply here with a demo. (https://npm.runkit.com/dayjs)