A single and dual date picker, written for angular 2+ projects.
Usage Example
<ct-date-picker [(date)]="date1" zIndex="100" formControlName="singlePicker">
<input #date class="form-control" />
</ct-date-picker>
<ct-dual-picker [(dateFrom)]="date2" [(dateTo)]="date3" zIndex="100" formControlName="dualPicker">
<input #dateFrom class="form-control" />
<input #dateTo class="form-control" />
</ct-dual-picker>
npm install --save ct-ng2-datepicker
<ct-date-picker [(date)]="date1" zIndex="100" formControlName="singlePicker">
<input #date class="form-control" />
</ct-date-picker>
Wrap a input field in the element. Mark the input field with #date
- date - date model
- dateChange - Event emitter for notification of date changes
- zIndex - Allows specification of a custom z-index for the picker.
- minDate - Minimum allowed date.
- maxDate - Maximum allowed date.
- match - Optional regex for properly parsing typed in dates, e.g. mm/dd/yyyy
<ct-dual-picker [(dateFrom)]="date2" [(dateTo)]="date3" zIndex="100" formControlName="dualPicker">
<input #dateFrom class="form-control" />
<input #dateTo class="form-control" />
</ct-dual-picker>
Wrap two input fields in the element. Mark each input #dateFrom and #dateTo respectively.
- dateFrom - date model
- dateTo - date model
- dateFromChange - Event emitter for notification of date changes
- dateToChange - Event emitter for notification of date changes
- zIndex - Allows specification of a custom z-index for the picker.
- minDate - Minimum allowed date.
- maxDate - Maximum allowed date.
- match - Optional regex for properly parsing typed in dates, e.g. mm/dd/yyyy
- Angular 2+ (common, core, forms)
- jQuery 3+ (see note below)
- moment 2
I have already implemented the datepicker using the renderer class to support Angular Universal Apps, and avoid needing jQuery. However at this time renderer is experimental. When it is no longer experimental the code will be updated.
Because the datepicker returns a moment date, not a string.
- 2.2.3 -- Remove sourcemap from dist build.
- 2.2.2 -- Fixed bug where dates weren't invalid when cleared
- 2.2.1 -- Fixed bug with validation on dual date picker.
- 2.2.0 -- Added regex matching for date validation
- 2.1.0 -- Added ability to validate dates on range, and moment.isValid
- 2.0.0 -- Removed unused api parameters. Added basic validation for reactive forms.
- 1.0.2 -- Notice about new repo.
- 1.0.1 -- Unspecified bug fixes (sorry, just starting to do this right)
- 1.0.0 -- Initial Release
- From 1.x to 2.x ..* Remove references to ctDisabled and inputClass from the datepickers. Instead apply those directly to the transcluded input.
- When using an ISO date (yyyy-mm-dd), the day selected on the calendar picker ends uup being localized for your timezone.