0.0.2 • Published 6 years ago

ng-date-value-accessor v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

ng-date-value-accessor

Build Status

npm version

A Date value accessor for Angular 5+, inspired by angular-date-value-accessor. You can use JavaScript Date objects directly with two-way data bindings (ngModel) as well as with reactive forms (formControlName/formControl).

In order to display the UTC date with timezone offset correctly (without breaking existing data, e.g. an ISO date 2018-01-31T23:00:00.000Z should be Feb 1st, 2018 in CET), the value will be formatted between angular form and native element.

Examples:

Add the attribute dateInput to a date input control:

<input type="date" name="birthday" [(ngModel)]="birthday" dateInput>

OR

<input type="date" formControlName="birthday" dateInput>

Installation:

Install the package via yarn/npm:

yarn add ng-date-value-accessor
npm install --save ng-date-value-accessor

Then import the module via NgModule:

// app.module.ts

import { DateValueAccessorModule } from "ng-date-value-accessor";

@NgModule({
  imports: [DateValueAccessorModule]
})
export class AppModule {}