1.1.1 • Published 4 years ago

ngx-material-luxon v1.1.1

Weekly downloads
63
License
MIT
Repository
github
Last release
4 years ago

ngx-material-luxon

npm Downloads MIT commitizen PRs styled with prettier All Contributors

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 Luxon DateTime 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!

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago