Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bug Report][3.6.6] Undefined date methods when using VCalendar with Luxon Adapter #19814

Closed
farrance opened this issue May 15, 2024 · 0 comments · Fixed by #19823 · May be fixed by YoutacRandS-VA/desec-stack#2
Closed

[Bug Report][3.6.6] Undefined date methods when using VCalendar with Luxon Adapter #19814

farrance opened this issue May 15, 2024 · 0 comments · Fixed by #19823 · May be fixed by YoutacRandS-VA/desec-stack#2
Assignees
Labels
C: VCalendar VCalendar labs T: bug Functionality that does not work as intended/expected
Milestone

Comments

@farrance
Copy link

Environment

Vuetify Version: 3.6.6
Vue Version: 3.4.27
Browsers: Chrome 124.0.0.0
OS: Mac OS 10.15.7

Steps to reproduce

Install Vue, Vuetify and the LuxonAdapter

Expected Behavior

The calendar to work and not report any errors.

Actual Behavior

Lots of date functions fail.

@date-io_luxon.js?v=aaaa9179:129 Uncaught (in promise) TypeError: date.hasSame is not a function
    at LuxonUtils.isSameDay (@date-io_luxon.js?v=aaaa9179:129:19)

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

It seems the object type for each date argument is the generic Date object and not Luxon's DateTime. I can make the errors go away if I polyfill each function that the VCalendar component calls by doing the horribly hacky solution below (wrapping each instance of date with DateTime.fromJSDate...

// Create the adapter
let luxon = new LuxonAdapter({ locale: 'en', formats: CUSTOM_DATE_TIME_FORMATS } );

// Clone the broken functions
let isSameDay = luxon.isSameDay;
let startOfMonth = luxon.startOfMonth;
let getWeekArray = luxon.getWeekArray;

// Convert to luxon dates
luxon.isSameDay = ( date, comparing ) => isSameDay( DateTime.fromJSDate( date ), DateTime.fromJSDate( comparing ) );
luxon.startOfMonth = ( value) => startOfMonth( DateTime.fromJSDate( value ) );

// Export the completed function
export default luxon;

Any help on a fix or better workaround would be much appreciated. Thank you all!

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected C: VCalendar VCalendar labels May 21, 2024
@KaelWD KaelWD added this to the v3.6.x milestone May 21, 2024
@KaelWD KaelWD added the labs label May 21, 2024
@KaelWD KaelWD self-assigned this May 21, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment