question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cant add isSameOrAfter plugin: Cannot read property '$i' of undefined

See original GitHub issue

Describe the bug

<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.4/dayjs.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.4/plugin/isSameOrAfter.min.js"></script>
<script>
dayjs.extend(window.isSameOrAfter);
</script>
Uncaught TypeError: Cannot read property '$i' of undefined
    at Function.v.extend (dayjs.min.js:1)
    at register:724

Expected behavior no error

Information

  • Day.js Version 1.10.4
  • OS: [e.g. iOS]
  • Browser chrome
  • Time zone: [Asia Singapore]

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

12reactions
cilfcommented, Oct 12, 2021

this worked for me:

import * as dayjs from 'dayjs';
import * as utc from 'dayjs/plugin/utc';
import * as timezone from 'dayjs/plugin/timezone';
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.tz.setDefault('Europe/Prague');
0reactions
josephcondoncommented, Dec 17, 2022

@chrisvidal I also had the same issue and found a different way of extending; Add dayjs_plugin_ before the plugin name you require.

<script>
dayjs.extend(window.dayjs_plugin_isSameOrAfter);
</script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cant add isSameOrAfter plugin: Cannot read property '$i' of undefined
Cant add isSameOrAfter plugin : Cannot read property '$i' of undefined.
Read more >
Issuehunt
Cant add isSameOrAfter plugin: Cannot read property '$i' of undefined #1494 · Describe the bug · Expected behavior · Information.
Read more >
jQuery plugin returning "Cannot read property of undefined"
I can't figure out why this isn't working. No matter how i write the jQuery code, it doesn't work. menuitems[i].action() just does NOT...
Read more >
IsSameOrAfter
IsSameOrAfter adds `.isSameOrAfter()` API to return a `boolean` indicating if a date is the same or after another date.
Read more >
dayjs - npm
2KB immutable date time library alternative to Moment.js with the same modern API . Latest version: 1.11.7, last published: 22 days ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found