@ng-not-found/ng-typed-date
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

NgTypedDate

Directive that uses the native date picker and binds the typed value to Date.

How to install with npm ?


npm i @ng-not-found/ng-typed-date --save

What is this component for?

This te directive has the purpose of facilitating the use of date fields, making the binding in the model in a typed way.

When working with dates in Angular, it binds with a string and that's usually not what we need. We need it to be a valid Date.

How do I use it?

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FormsModule } from '@angular/forms';
import { NgTypedDateModule } from '@ng-not-found/ng-typed-date';

@NgModule({
declarations: [
  AppComponent,
],
imports: [
  FormsModule,
  BrowserModule,
  AppRoutingModule,
  NgTypedDateModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
<form #form="ngForm">
  <input type="date" [(ngModelDate)]="data" name="data" />
  <input type="datetime-local" [(NgModelDatetimeLocal)]="data" name="data" />
</form>

Properties

Name Type
min Date / string
max Date / string

Package Sidebar

Install

npm i @ng-not-found/ng-typed-date

Weekly Downloads

18

Version

5.0.0

License

MIT

Unpacked Size

111 kB

Total Files

16

Last publish

Collaborators

  • refaragao
  • renan.aragao