ng-date-value-accessor
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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 {}

Package Sidebar

Install

npm i ng-date-value-accessor

Weekly Downloads

19

Version

0.0.2

License

MIT

Unpacked Size

17.3 kB

Total Files

25

Last publish

Collaborators

  • 007300