[Bug Report][3.6.6] Undefined date methods when using VCalendar with Luxon Adapter #19814
Description
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!