All Projects → DanielYKPan → Date Time Picker

DanielYKPan / Date Time Picker

Licence: mit
Angular Date Time Picker (Responsive Design)

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Date Time Picker

Angular-Movies
Angular Movies | TV Shows is a simple web app that consumes The Movie DB API - Angular 13 + Material Angular
Stars: ✭ 35 (-93.37%)
Mutual labels:  angular-material, angular-cli, angular6
Ajsf
Angular JSON Schema Form
Stars: ✭ 266 (-49.62%)
Mutual labels:  angular-material, angular-cli, angular6
Angular5 Seed
Angular5 Seed for Application
Stars: ✭ 222 (-57.95%)
Mutual labels:  angular-material, angular-cli, angular6
ng-webworker
Repository featuring a web worker running within Angular.
Stars: ✭ 14 (-97.35%)
Mutual labels:  angular-cli, angular6
awesome-angular
💖 A list of awesome Angular (2️⃣➕) resources
Stars: ✭ 61 (-88.45%)
Mutual labels:  angular-material, angular-cli
ng-math
Math Flashcard Progressive Web App built with Angular 2
Stars: ✭ 17 (-96.78%)
Mutual labels:  angular-material, angular-cli
angular-starter
🚀 Angular 14 Starter with Storybook, Transloco, Jest, TestCafe, Docker, ESLint, Material & Prettier 🚀
Stars: ✭ 124 (-76.52%)
Mutual labels:  angular-material, angular-cli
nglp-angular-material-landing-page
NGLP is an Angular Material Landing Page.
Stars: ✭ 32 (-93.94%)
Mutual labels:  angular-material, angular6
ng-electron-devkit
Angular Webpack Build Facade for Electron
Stars: ✭ 12 (-97.73%)
Mutual labels:  angular-cli, angular6
ncg-crud-ngx-md
Angular 4+ Material Design CRUD/Admin app by NinjaCodeGen http://DNAfor.NET
Stars: ✭ 36 (-93.18%)
Mutual labels:  angular-material, angular-cli
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-51.52%)
Mutual labels:  angular-cli, angular6
Angular Ssr
Angular 4+ server-side rendering solution compatible with @angular/material, jQuery, and other libraries that touch the DOM (as well as providing a rich feature set!)
Stars: ✭ 283 (-46.4%)
Mutual labels:  angular-material, angular-cli
meditation-plus-angular
DEVELOPMENT MOVED TO
Stars: ✭ 15 (-97.16%)
Mutual labels:  angular-material, angular-cli
feedback
An angular module provide a directive for feedback
Stars: ✭ 35 (-93.37%)
Mutual labels:  angular-material, angular6
login-form-angular2
A simple login form using the angular2 material design and the angular-CLI.
Stars: ✭ 21 (-96.02%)
Mutual labels:  angular-material, angular-cli
angular-youtube-player
Simple youtube player created with angular and typescript. See demo.
Stars: ✭ 35 (-93.37%)
Mutual labels:  angular-cli, angular6
loopback3 angular6 bootstrap4
API Rest build by Loopback. Frontend on Angular 6
Stars: ✭ 26 (-95.08%)
Mutual labels:  angular-cli, angular6
AuthGuard
Example repo for guarding routes post
Stars: ✭ 42 (-92.05%)
Mutual labels:  angular-cli, angular6
node-casperjs-aws-lambda
Base scaffolding app for a casperjs/phantomjs app running on Amazon (AWS) Lambda
Stars: ✭ 52 (-90.15%)
Mutual labels:  angular-material, angular-cli
Angular Interview Questions
Most extensive Angular interview questions based on your level.
Stars: ✭ 354 (-32.95%)
Mutual labels:  angular-material, angular-cli

Angular Date Time Picker

npm npm

Angular date time picker - Angular reusable UI component This package supports Angular 8

Breaking Changes

  • The picker has been updated for Angular 7+ apps.

Description

Simple Angular date time picker. Online doc is here, Online demo(StackBlitz) is here. This picker is responsive design, so feel free to try it in your desktops, tablets and mobile devices.

How to Use

  1. Install with npm:npm install ng-pick-datetime --save
  2. Add styles. If you are using Angular CLI, you can add this to your styles.css:
    @import "~ng-pick-datetime/assets/style/picker.min.css";
    
    If you are not using the Angular CLI, you can include the picker.min.css via a <link> element in your index.html.
  3. Add OwlDateTimeModule and OwlNativeDateTimeModule to your @NgModule like example below
     import { NgModule } from '@angular/core';
     import { BrowserModule } from '@angular/platform-browser';
     import { MyTestApp } from './my-test-app';
    
     import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime';
    
     @NgModule({
         imports: [ 
             BrowserModule, 
             OwlDateTimeModule, 
             OwlNativeDateTimeModule,
         ],
         declarations: [ MyTestApp ],
         bootstrap:    [ MyTestApp ]
     })
     export class MyTestAppModule {}
    
  4. Connecting a picker to an input and a trigger.
    <input [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1" placeholder="Date Time">
    <owl-date-time #dt1></owl-date-time>
    
    <input [owlDateTime]="dt2" placeholder="Date Time">
    <span [owlDateTimeTrigger]="dt2"><i class="fa fa-calendar"></i></span>
    <owl-date-time #dt2></owl-date-time>
    
    The examples above are quite basic. The picker has much more features, and you could learn more about those from demo page.

Animation

This picker uses angular animations to improve the user experience, therefore you need to install @angular/animations and import BrowserAnimationsModule to your application.

npm install @angular/animations --save
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        //...
    ],
    //...
})
export class YourAppModule { }

If you prefer to disable animation effect, use NoopAnimationsModule instead.

Choose a date implementation

The date-time picker was built to be date implementation agnostic. Developers need to make sure to provide the appropriate pieces for the picker to work with their chosen implementation. There are two pre-made modules, users need to import one of them or build your own one (learn more about this from here).

  • OwlNativeDateTimeModule - support for native JavaScript Date object
  • OwlMomentDateTimeModule - support for MomentJs

Properties for owl-date-time

Name Type Required Default Description
pickerType both, calendar, timer Optional both Set the type of the dateTime picker. both: show both calendar and timer, calendar: only show calendar, timer: only show timer.
pickerMode popup, dialog Optional popup The style the picker would open as.
startView month, year, multi-year Optional month The view that the calendar should start in.
startAt T/null Optional null The moment to open the picker to initially.
firstDayOfWeek number Optional 0 Set the first day of week. Valid value is from 0 to 6. 0: Sunday ~ 6: Saturday
showSecondsTimer boolean Optional false When specify it to true, it would show a timer to configure the second's value
hideOtherMonths boolean Optional false Whether to hide dates in other months at the start or end of the current month
hour12Timer boolean Optional false When specify it to true, the timer would be in hour12 format mode
stepHour number Optional 1 Hours to change per step.
stepMinute number Optional 1 Minutes to change per step.
stepSecond number Optional 1 Seconds to change per step.
scrollStrategy ScrollStrategy Optional BlockScrollStrategy Define the scroll strategy when the picker is open. Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies.
disabled boolean Optional false When specify to true, it would disable the picker.
backdropClass string/string[] Optional null Custom class for the picker backdrop.
panelClass string/string[] Optional null Custom class for the picker overlay panel.

Events for owl-date-time

Events Parameter Description
afterPickerOpen null Callback to invoke when the picker is opened
afterPickerClosed null Callback to invoke when the picker is closed.
yearSelected T Callback to invoke when the year is selected.This doesn't imply a change on the selected date.
monthSelected T Callback to invoke when the month is selected.This doesn't imply a change on the selected date.

Properties for input[owlDateTime]

Name Type Required Default Description
owlDateTime OwlDateTimeComponent<T> Require null The date time picker that this input is associated with.
owlDateTimeFilter ( date: T)=>boolean Optional null A function to filter date time.
disabled boolean Optional false When specify to true, it would disable the picker's input.
min <T> Optional null The minimum valid date time.
max <T> Optional null The maximum valid date time.
selectMode single, range, rangeFrom, rangeTo Optional single Specify the picker's select mode. single: a single value allowed, range: allow users to select a range of date-time, rangeFrom: the input would only show the 'from' value and the picker could only selects 'from' value, rangeTo: the input would only show the 'to' value and the picker could only selects 'to' value.
rangeSeparator string Optional ~ The character to separate the 'from' and 'to' in input value in range selectMode.

Events for input[owlDateTime]

Events Parameter Description
dateTimeChange source: OwlDateTimeInput, value: input value, input: the input element Callback to invoke when change event is fired on this <input [owlDateTime]>
dateTimeInput source: OwlDateTimeInput, value: input value, input: the input element Callback to invoke when an input event is fired on this <input [owlDateTime]>.

Properties for [owlDateTimeTrigger]

Name Type Required Default Description
owlDateTimeTrigger OwlDateTimeComponent<T> Require null The date time picker that this trigger is associated with.
disabled boolean Optional false When specify to true, it would disable the trigger.

Properties for [owlDateTimeTrigger]

Name Type Required Default Description
owlDateTimeTrigger OwlDateTimeComponent<T> Require null The date time picker that this trigger is associated with.
disabled boolean Optional false When specify to true, it would disable the trigger.

Properties for owl-date-time-inline

Name Type Required Default Description
pickerType both, calendar, timer Optional both Set the type of the dateTime picker. both: show both calendar and timer, calendar: only show calendar, timer: only show timer.
startView month, year, multi-year Optional month The view that the calendar should start in.
startAt T/null Optional null The moment to open the picker to initially.
firstDayOfWeek number Optional 0 Set the first day of week. Valid value is from 0 to 6. 0: Sunday ~ 6: Saturday
showSecondsTimer boolean Optional false When specify it to true, it would show a timer to configure the second's value
hideOtherMonths boolean Optional false Whether to hide dates in other months at the start or end of the current month
hour12Timer boolean Optional false When specify it to true, the timer would be in hour12 format mode
stepHour number Optional 1 Hours to change per step.
stepMinute number Optional 1 Minutes to change per step.
stepSecond number Optional 1 Seconds to change per step.
disabled boolean Optional false When specify to true, it would disable the picker.
owlDateTimeFilter ( date: T)=>boolean Optional null A function to filter date time.
min <T> Optional null The minimum valid date time.
max <T> Optional null The maximum valid date time.
selectMode single, range, rangeFrom, rangeTo Optional single Specify the picker's select mode. single: a single value allowed, range: allow users to select a range of date-time, rangeFrom: the input would only show the 'from' value and the picker could only selects 'from' value, rangeTo: the input would only show the 'to' value and the picker could only selects 'to' value.

Localization and DateTime Format

Localization for different languages and formats is defined by OWL_DATE_TIME_LOCALE and OWL_DATE_TIME_FORMATS. You could learn more about this from here.

Dependencies

none

Demo

  • Online doc is here
  • Online demo(StackBlitz) is here

License

  • License: MIT

Author

Daniel YK Pan

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].