@crotched/material-luxon-adapter

Crotched components for Angular

Usage no npm install needed!

<script type="module">
  import crotchedMaterialLuxonAdapter from 'https://cdn.skypack.dev/@crotched/material-luxon-adapter';
</script>

README

Luxon Date adapter

The Luxon Date adapter allows the Angular Material Datepicker component to work with Luxon DateTime objects.

How to use

import {MatLuxonDateModule} from '@crotched/material-luxon-adapter';

@NgModule({
  imports: [MatDatepickerModule, MatLuxonDateModule]
})

By default the LuxonDateAdapter creates dates in your time zone specific locale. You can change the default behaviour to parse dates as UTC by providing the MAT_LUXON_DATE_ADAPTER_OPTIONS and setting it to useUtc: true.

import {MAT_LUXON_DATE_ADAPTER_OPTIONS, MatLuxonDateModule} from '@crotched/material-luxon-adapter';

@NgModule({
  imports: [MatDatepickerModule, MatLuxonDateModule],
  providers: [
    {provide: MAT_LUXON_DATE_ADAPTER_OPTIONS, useValue: {useUtc: true}}
  ]
})