ngx-material-luxon
v1.1.1
Published
<h1 align="center">
Downloads
2,269
Maintainers
Readme
ngx-material-luxon
Luxon Date Adapter for Angular Material
Credits for most of this go to crisbeto in https://github.com/angular/components/pull/14681.
Original PR has been left unmerged due to https://github.com/angular/components/pull/14681#issuecomment-457685311
Features
- ✅ Drop an import in your
@NgModule
and enjoy LuxonDateTime
objects
Table of Contents
Installation
NPM
npm install ngx-material-luxon --save
Yarn
yarn add ngx-material-luxon
Usage
import { MatLuxonDateModule } from 'ngx-material-luxon';
@NgModule({
imports: [MatLuxonDateModule]
})
class AppModule { }
FAQ
Specifying the first day of the week
Luxon does not support have built-in support for returning the first day of the week of the current locale. However, the library allows overriding it via an optional hook.
Example:
const firstDayOfWeek = (locale: string) => {
// 0 = Sunday, 1 = Monday, etc
return 1;
}
@NgModule({
imports: [LuxonDateModule],
providers: [
{
provide: MAT_LUXON_DATE_ADAPTER_OPTIONS,
useValue: { firstDayOfWeek },
},
],
})
For most apps, a simple return like above is probably fine. For more complex apps, you can use a third party library like: weekstart
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!