matheo / angular

Open Source Angular Libraries: MatDataSource, MatDatepicker
http://matheo.co/demos/
MIT License
60 stars 15 forks source link

Datetime picker: Luxon support #17

Closed wiegell closed 3 years ago

wiegell commented 3 years ago

First of all, good job with the datetimer picker component!

Is there any way to use it with: https://www.npmjs.com/package/ngx-material-luxon Which is pretty much plug-n-play with the original matdatepicker?

matheo commented 3 years ago

Hi @wiegell! It is possible to have this one in the short-term, but after I finish my duties and features of @myndpm/dyn-forms

matheo commented 3 years ago

Hi @wiegell I had some issues building the package but got them figured out now you can try @matheo/datepicker@11.2.9 using the new import { MatLuxonDateModule } from '@matheo/datepicker/luxon' in your application.

Please confirm that the formats I've used are the appropiated ones: https://github.com/matheo/angular/blob/master/libs/datepicker/luxon/luxon-date-formats.ts

I've introduced a Breaking-Change :man_facepalming: fortunately it's easy to fix, updating some imports to @matheo/datepicker/core

wiegell commented 3 years ago

So far it seems to work perfectly! Amazing response time :) Regarding the formats, it seem appropriate for "en-GB", but i don't seem to be able to override them? Will try and make stackblitz later, it gives error again on ivy compile atm.....

What i want is another monthDayLabel (for danish use):

const CUSTOM_MAT_LUXON_DATE_FORMATS: MatDateFormats = {
  parse: {
    dateInput: 'D',
    datetimeInput: 'f',
    timeInput: 'h:mm',
    monthInput: 'LLL',
    yearInput: 'yyyy',
  },
  display: {
    dateInput: 'D',
    datetimeInput: 'f',
    timeInput: 'T',
    monthInput: 'LLL yyyy',
    yearInput: 'yyyy',
    dateA11yLabel: 'DD',
    monthLabel: 'LLL',
    monthDayLabel: 'd. LLL',
    monthDayA11yLabel: 'LLLL d',
    monthYearLabel: 'LLL yyyy',
    monthYearA11yLabel: 'LLLL yyyy',
    timeLabel: 'T',
  },
};