vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Feature Request] Possible to extend default DateAdapter with functions

Open karmats opened this issue 9 months ago • 0 comments

Problem to solve

The default DateAdapter has a great set of functions. But if you need one or more extra functions you either need to create your own adapter or use a third-party library adapter. It would be fantastic if there was a way to use existing adapter-functions and extend it with your own.

Proposed solution

  1. Export VuetifyDateAdapter so that it's possible to extend that class with functions.
export class MyDateAdapter extends VuetifyDateAdapter {
  ....
  myDateFunction() {
    return new Date();
  }
}
  1. Extend the date options object with a new functions-option that will work the same way as current formats-option. The DateAdapter interface would need to be exported so that typescript can work as expected
interface MyDateAdapter extends DateAdapter<Date> {
  myDateFunction(): Date;
}

karmats avatar May 27 '24 08:05 karmats