Détail du package

ngx-material-timepicker

Agranom226.7kMIT13.1.1

Handy material design timepicker for angular

angular, angular 2, angular 4, angular 5

readme

Angular Material Timepicker

Build Status codecov npm version

Handy multifunctional material design timepicker for Angular 6.0+

Demo

https://agranom.github.io/ngx-material-timepicker/

Table of contents

Getting started

Install timepicker through npm:

npm install --save ngx-material-timepicker
npm install --save luxon

Next import the timepicker module into your app's module:

import {NgModule} from '@angular/core';
import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker';

@NgModule({
  imports: [NgxMaterialTimepickerModule]
})
export class MyModule {}

Finally connect the timepicker to an input via a template property:

<input [ngxTimepicker]="picker">
<ngx-material-timepicker #picker></ngx-material-timepicker>

The timepicker opens once you click on the input

Internationalization

Timepicker supports locales in format BCP 47. It has en-US locale by default.

To override default locale and numbering system (latn or arab):

import {NgModule} from '@angular/core';
import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker';

@NgModule({
  imports: [NgxMaterialTimepickerModule.setOpts('ar-AE', 'arab')]
})
export class MyModule {}

Documentation

API reference for Angular Material Timepicker

import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker';

NgxTimepicker

Directive responsible for managing the timepicker popup and setting value to input

Selector: ngxTimepicker

Properties

Name Description
@Input()

ngxTimepicker: NgxMaterialTimepickerComponent | The timepicker that this input is associated with. | | @Input() disabled: boolean | Weather the timepicker popup should be disabled. | | @Input() value: string | Set a default value and time for a timepicker. The format of the time is in 12 hours notation 11:00 PM or in 24 hours notation 23:00. A Date string won't work. | | @Input() format: number | 12 or 24 . 12h/24h view for hour selection clock . 12 (AM/PM) format by default. | | @Input() min: string or DateTime | Set min time for timepicker (11:15 pm ) | | @Input() max: string or DateTime | Set max time for timepicker (11:15 pm ) | | @Input() disableClick: boolean | Set true to disable opening timepicker by clicking on the input |

NgxMaterialTimepickerComponent

Component responsible for visualisation the timepicker

Selector: ngx-material-timepicker

Properties

Name Description
@Input()

cancelBtnTmpl: TemplateRef<Node> | Set if you want to change cancel button to your custom one. | | @Input() confirmBtnTmpl: TemplateRef<Node> | Set if you want to change confirm button to your custom one. | | @Input() editableHintTmpl: TemplateRef<Node> | Set if you want to change dial hint to your custom one. Works only if enableKeyboardInput = true | | @Input() ESC: boolean | Disable or enable closing timepicker by ESC. | | @Input() enableKeyboardInput: boolean | To disable or enable changing time through a keyboard on the timepicker dial without interaction with a clock face. Set false by default | | @Input() minutesGap: number | To define a gap between minutes. Set 1 by default | | @Input() defaultTime: string | Set default time for a timepicker. 12:00 AM by default | | @Input() preventOverlayClick: boolean | Set true to prevent closing the timepicker by overlay click. Uses false by default | | @Input() disableAnimation: boolean | Set true to prevent opening and closing timepicker animation. Uses false by default | | @Input() hoursOnly: boolean | Set true to prevent switching to minutes automatically once hour is selected. Uses false by default | | @Input() theme: NgxMaterialTimepickerTheme | Custom css properties which will override the defaults | | @Input() timepickerClass: string | To provide a custom css class for the timepicker | | @Output() timeSet: EventEmitter\<string\> | Emits time when that was set. | | @Output() opened: EventEmitter\<null\> | Emits after timepicker was opened. | | @Output() closed: EventEmitter\<null\> | Emits after timepicker was closed. | | @Output() hourSelected: EventEmitter\<number\> | Emits after hour was selected. | | @Output() timeChanged: EventEmitter\<string\> | Emits once time was changed. |

NgxTimepickerFieldComponent

The timepicker as a control.

Selector: ngx-timepicker-field

Properties

Name Description
@Input()

disabled: boolean | Whether the timepicker is disabled| | @Input() toggleIcon: TemplateRef\<HTMLObjectElement\> | Provide custom svg icon for toggle button | | @Input() buttonAlign: 'right' or 'left' | Positioning toggle button (right by default) | | @Input() clockTheme: NgxMaterialTimepickerTheme | Custom css properties which will override timepicker clock | | @Input() controlOnly: boolean | Hide or display toggle button with the timepicker clock | | @Input() format: number | 12 or 24 . Set format for timepicker. 12 (AM/PM) format by default. | | @Input() cancelBtnTmpl: TemplateRef\<Node\> | Set if you want to change cancel button for timepicker to your custom one. | | @Input() confirmBtnTmpl: TemplateRef\<Node\> | Set if you want to change confirm button for timepicker to your custom one. | | @Input() min: string or DateTime | Set min time for timepicker (11:15 pm ) | | @Input() max: string or DateTime | Set max time for timepicker (11:15 pm ) | | @Input() minutesGap: number | To define a gap between minutes. Set 1 by default | | @Output() timeChanged: EventEmitter\<string\> | Emit a new time once it is changed. |

NgxMaterialTimepickerToggleComponent

Component responsible for opening the timepicker.

Selector: ngx-material-timepicker-toggle

Properties

Name Description
@Input()

for: NgxMaterialTimepickerComponent | Timepicker instance that the button will toggle | | @Input() disabled: boolean | Whether the toggle button is disabled |

NgxMaterialTimepickerToggleIconDirective

Can be used to override the icon of a NgxMaterialTimepickerToggleComponent.

Selector: [ngxMaterialTimepickerToggleIcon]

NgxMaterialTimepickerThemeDirective (deprecated)

Can be used to override styles of a NgxMaterialTimepicker.

Selector: ngx-material-timepicker[ngxMaterialTimepickerTheme]

Properties

Name Description
@Input()

ngxMaterialTimepickerTheme: NgxMaterialTimepickerTheme | Custom css properties which will override the defaults |

Development

Prepare your environment

Install local dev dependencies: npm install while current directory is this repo.

Development server

Run npm start to start a development server on a port 4200.

Open http//:localhost:4200 on your browser.

Tests

Run npm test to run tests once or npm run test:watch to continually run tests.

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file

13.1.0 (2023-06-19)

Features

  • feat(ngx-material-timepicker): make TIME_LOCALEand NUMBERING_SYSTEM part of the public api allow consuming applications to provide such values by themselves instead of using NgxMaterialTimepickerModule.setOpts(), closes (#409),

Fixes

  • fix(ngx-material-timepicker): fix @Input order dependencies when setting value, fixes (#320)

  • fix(ngx-material-timepicker): fix throwing error if set value input before ngxTimepicker,

    fixes [(#344)](https://github.com/Agranom/ngx-material-timepicker/issues/344)
  • fix(ngx-material-timepicker): fix issue with keyboard input and minutes gap, fixes (#323)

Improvements

  • clear current time while typing the new one, closes (#417)

  • automatically switch to minute after inputting the correct hour, closes (#417)

BREAKING CHANGES

13.0.3 (2023-06-14)

  • move luxon library from dependencies to peerDependencies to avoid duplications in bundle, closes (#355)

BREAKING CHANGES

12.1.0 (2023-06-13)

  • feat(ngx-material-timepicker): add Ivy partial compilation mode, closes (#401)

  • remove entry components

Improvements

  • remove unnecessary exports from module
  • reduce package size

5.6.0 (2023-06-12)

Features

  • feat(ngx-material-timepicker-field): add minutesGap to ngx-material-timepicker-field component, closes (#236), (#248),

Fixes

  • fix(ngx-material-timepicker-field): fix hours validation with min/max values set, fixes (#346), (#369),

5.5.5 (2023-06-09)

Fixes

  • fix(ngx-material-timepicker): fix npm package, fixes (#431)

5.5.4 (2023-06-08)

Fixes

  • fix(ngx-material-timepicker): remove default browser's outline in focus-visible state
  • fix(ngx-material-timepicker): replace the Narrow No-Break Space (NNBSP) for a standard space, fixes (#427)

5.5.3 (2020-05-28)

Fixes

  • fix(ngx-material-timepicker): fix error cannot read property 'replace' of null on 24 Hrs format, fixes (#341)
  • fix(ngx-material-timepicker): fix issue with displaying time 24:xx instead of 00:xx with default locale, fixes (#342)

5.5.2 (2020-05-11)

Fixes

  • fix(ngx-material-timepicker): avoid updating time after closing timepicker, closes (#326)

  • fix(ngx-material-timepicker.module): fix NullInjectorError: No provider for InjectionToken TimeLocale for lazy loaded modules, closes (#335), closes (#259),

5.5.1 (2020-03-28)

Fixes

  • fix(ngx-material-timepicker): revert to angular 8 and rebuild the package, closes (#315)

5.5.0 (2020-03-25)

Features

  • feat(ngx-material-timepicker-field): add min and max time limits, closes (#184)

Fixes

  • feat(ngx-material-timepicker): fix error that shows after closing timepicker without time changed in 24 format, fixes (#311)

5.4.3 (2020-03-14)

Fixes

  • fix(ngx-material-timepicker): prevent typing numbers in editable dial, fixes (#305)

5.4.2 (2020-03-11)

Fixes

  • fix(ngx-material-timepicker): fix setting time between interval 00:00 - 00:59, fixes (#301)

5.4.1 (2020-03-07)

Fixes

  • fix(ngx-material-timepicker-field): fix bug cannot read property 'replace' of null, fixes (#295)

5.4.0 (2020-02-29)

Fixes

  • fix(ngx-material-timepicker): fix setting time from keyboard, fixes (#243), (#266)

  • fix(ngx-material-timepicker-dial): + prevent selecting minutes when hoursOnly is true, fixes (#281)

  • fix(ngx-material-timepicker): ! fix invalid DateTime in IE 11, fixes (#222)

  • fix(ngx-material-timepicker): ! fix invalid DateTime when setting 00:++, fixes (#285)

5.3.0 (2019-12-22)

Fixes

  • fix(SSR): change HTMLInputElement types to any

Features

  • feat(ngx-material-timepicker): add export of standalone components, closes (#151)

  • feat(ngx-material-timepicker-field): add timeChanged @Output event, that emits once time changes, closes (#207)

  • feat(ngx-material-timepicker): add timeChanged @Output event, that emits once time changes

5.2.3 (2019-11-21)

Fixes

  • fix(ngx-material-timepicker-field): bug with setting time to null, fixes (#252)

  • fix(ngx-material-timepicker-field): bug with changing time via keyboard, fixes (#243)

  • fix(ngx-material-timepicker): fix bugs which occur when Ivy is enabled, fixes (#247)

5.2.2 (2019-11-02)

Fixes

  • fix(ngx-material-timepicker-field): display hours and minutes in 2-digit format, fixes (#241), (#243)

  • fix(ngx-material-timepicker): SSR support (changing window event types to any)

5.2.1 (2019-10-12)

Fixes

  • fix(ngx-material-timepicker): bug with formatting time while typing, fixes (#233)

  • fix(ngx-material-timepicker-field): bug with setting time without interaction with a clock face, fixes (#211)

5.2.0 (2019-10-05)

Features

  • feat(ngx-material-timepicker): add timepickerClass property to set custom class for the timepicker, closes (#227)

  • feat(ngx-material-timepicker): add hoursOnly property to prevent switching to minutes automatically, closes (#208)

  • feat(ngx-material-timepicker): add appendToInput property that allows append timepicker to input (without modal), closes (#185)

Fixes

  • fix(ngx-timepicker-field): bug with changing minutes via input field, fixes (#229)

  • fix(ngx-material-timepicker): bug with theming, fixes (#218)

  • fix(ngx-material-timepicker): fix error Cannot read property 'split' of null when setting time as null or undefined, fixes (#215)

  • fix(ngx-material-timepicker): clicking area for 00 and 12 in 24 format, fixes (#114)

5.1.1 (2019-09-17)

Fixes

  • fix(ngx-material-timepicker): fix appending an empty component to body, fixes (#130)

5.1.0 (2019-09-11)

Features

  • feat(ngx-material-timepicker-theme): add customization for editable dial, closes (#204)

  • feat(ngx-material-field): add custom buttons, closes (#200)

Fixes

  • fix(ngx-material-timepicker): your minutes (NaN) doesnt match your minutesGap when no time picked.

  • fix(ngx-material-timepicker): dynamic format change, fixes (#104), fixes (#198)

  • fix(ngx-material-timepicker): incorrect typings, fixes (#195)

  • fix(ngx-material-timepicker): cutting timepicker when parent container has overflow: hidden, fixes (#130)

Improvements

  • improvement(ngx-material-timepicker): set default time equal to min time when min time is provided and default time isn't, closes (#203), fixes (#202)

BREAKING CHANGES

5.0.0 (2019-09-06)

Add internationalization, so that it might affect on time format.

Features

  • feat(ngx-material-timepicker): add internationalization for timepicker. Default locale is set to en-US, closes (#154)

Fixes

  • fix(ngx-material-timepicker): add @types/luxon to dependencies, so that it will be installed with ngx-material-timepicker, closes (#189)

4.0.2 (2019-07-28)

Fixes

  • fix(autofocus): provide { preventScroll: true } argument to .focus() method , closes (#177)

  • fix(ngx-timepicker-field): set default time only if it is provided, closes (#174)

Improvements

  • improvement(ngx-timepicker-field): provide css class for disabled timepicker, closes (#174)

4.0.1 (2019-07-15)

Fixes

  • fix(ngx-timepicker-field): fix bug when dynamically change format, closes (#170)

BREAKING CHANGES

4.0.0 (2019-06-21)

Upgrade package to angular 8

3.3.1 (2019-06-21)

  • fix(ngx-timepicker): downgrade angular to v7 and recompile package to fix warning, closes (#158)

    • fix(time-formatter.pipe): handle null or empty input closes (#160)

3.3.0 (2019-06-13)

Features

  • feat(ngx-timepicker): make the timepicker compatible with Angular 8, closes (#148)

  • feat(ngx-timepicker): remove luxon from peerDependencies and add to dependencies, closes (#147)

3.2.2 (2019-06-09)

Fixes

  • fix(ngx-timepicker-field): add ngx-timepicker-fieldto public API

3.2.1 (2019-06-09)

Fixes

  • fix(ngx-material-timepicker): fix bug with module resolution, closes (#152)

3.2.0 (2019-06-08)

Features

  • feat(ngx-timepicker-field): create ngx-timepicker-field component, closes (#55)

3.1.0 (2019-05-13)

Features

  • feat(ngx-material-timepicker): add disableAnimation input to prevent timepicker animation, closes (#134)

3.0.3 (2019-04-24)

Fixes

  • fix(ngx-material-timepicker): move functions from namespaces, closes (#94)

  • fix(ngx-material-timepicker): min/max time validation with 24-hours format, closes (#127)

  • fix(ngx-material-timepicker-facet): set minutes angle step according to minutes gap, closes (#132)

3.0.2 (2019-03-23)

Fixes

  • fix(ngx-material-timepicker): fix issues with selecting time (cf80399), closes (#121), (#122)

  • fix(ngx-material-timepicker-period): disable to set period if it is not valid (b7c3626), closes (#120)

Improvements

  • improvement(ngx-material-timepicker-component): provide NgxMaterialTimepickerComponent as public API (159167a), closes (#119)

BREAKING CHANGES

3.0.1 (2019-03-17)

  • Decrease package size by changing momentJs to luxon, closes (#78)

  • improvement(NgxMaterialTimepickerModule): remove forRoot() static method and add provideIn property to services, closes (#83)

  • Update peerDependencies

2.13.0 (2019-02-16)

Features

  • feat(ngx-material-timepicker): add hourSelected event emitter (dd43874), closes (#108)

  • feat(ngx-material-timepicker): add opened event emitter (5bc9cc0), closes (#112)

  • feat(ngx-material-timepicker-dial): add possibility to set a custom hint template (479f311), relates to (#103)

Fixes

  • fix(clock face): fix bug with dead zone in 12 or 00 time section (07a8618), closes (#109)

Improvements

  • improvement(ngx-material-timepicker-dial): show/hide dial hint onFocus/onBlur dial control (c96da39), relates to (#103)

2.12.0 (2019-01-26)

Features

  • feat(ngx-material-timepicker): preventOverlayClick property was added to prevent closing the timepicker by overlay click, closes (#89)

Fixes

  • fix(ngx-material-timepicker): add readable error and preventing setting default time if default minute isn't allowed with provided minutesGap, closes (#81) and closes (#97)

Improvements

  • improvement(minutesGap): prevent setting null or undefined
  • improvement(ngx-material-timepicker): change time by keyboard arrows including minutesGap, closes (#103)

2.11.2 (2019-01-07)

Fixes

  • fix(ngx-material-timepicker): fix bug with circular dependencies, closes (#91)

2.11.1 (2018-12-30)

Fixes

  • fix(NgxMaterialTimepickerTheme): add interfaces to public API, closes (#85)
  • fix(ngx-material-timepicker-dial): centered time position, closes (#86)
  • fix(ngx-material-timepicker): make horizontal position only for mobile devices with landscape orientation, closes (#87)

2.11.0 (2018-12-22)

Features

  • feat(ngx-material-timepicker): add NgxMaterialTimepickerDirective for theming, closes (#71)

2.10.0 (2018-11-30)

Features

  • feat(ngx-material-timepicker): add @Input() defaultTime to set default time for a timepicker dial only, closes (#64)

2.9.0 (2018-11-24)

Features

  • feat(timepicker dial): add accessibility from keyboard and input restrictions for a dial, closes (#56)

2.8.4 (2018-11-20)

Fixes

  • fix(ExpressionChangedAfterItHasBeenCheckedError): closes (#56)

2.8.4 (2018-11-20)

Fixes

  • fix(ExpressionChangedAfterItHasBeenCheckedError): closes (#66)
  • fix(timepicker dial control): prevent auto showing keyboard on IOS, closes (#68)

2.8.3 (2018-11-02)

Fixes

  • fix(timepicker output): fix format appearance, closes (#62)
  • fix(timepicker clock face): fix touch events, closes (#61)
  • fix(timepicker dial): change focus on dial (hour <=> minute)

2.8.2 (2018-10-29)

Fixes

  • fix(timepicker period): change text of warning text box and hide it after few seconds, closes (#44)

2.8.1 (2018-10-24)

Fixes

  • fix(timepicker period): disable switching between periods if there are no available time to select, closes (#44)

2.8.0 (2018-10-23)

Features

  • feat(ngx-material-timepicker): add option minutesGap that defines a gap between minutes, closes (#51)

2.7.0 (2018-10-21)

Features

  • feat(ngx-material-timepicker): add flag enableKeyboardInput that enables or disables changing time through a keyboard on the timepicker dial without interaction with a clock face, closes (#49)

Fixes

  • fix(timepicker hours): fix bug with wrong disabling hours on min or max ranges.

2.6.5 (2018-10-15)

Fixes

  • fix(timepicker minutes face): fix disabling minutes within min and max time range, closes (#43)

2.6.4 (2018-10-10)

Fixes

  • fix(timepicker minutes face): fix bug with wrong disabling minutes, closes (#44)

  • ref(timepicker clock face): change clock face from hours to minutes only if user stop interacting with clock face (mouseup event) and time was changed

2.6.3 (2018-10-08)

Fixes

  • fix(timepicker minutes face): fix disabling minutes properly in a time range, closes (#43)

2.6.2 (2018-10-07)

Fixes

  • fix(clock hand): change clock hand position if time is not available

2.6.1 (2018-10-07)

Fixes

  • fix(ngxTimepicker): fix bug with setting disabled time to input, closes (#44)
  • fix(time range): fix bug with 12 pm selection, closes (#43)

2.6.0 (2018-09-15)

Features

  • feat(ngx-material-timepicker-component): add closed output, that fires after timepicker was closed

Fixes

  • fix(timepicker clock face): reset time after cancelation timepicker (3398591), closes (#35)
  • fix(timepicker clock hand): set different sizes for portrait and landscape orientations (429ddfd)

2.5.4 (2018-09-03)

Fixes

  • fix(timepicker): fix time formatter for 24-hour format (09a15c4), closes (#30),

2.5.3 (2018-08-28)

Fixes

  • fix(ngx timepicker directive): fix output value with reactive forms (3eb6312), closes (#30)

2.5.2 (2018-08-16)

Fixes

  • fix(timepicker hour face): change clock hand size to fit it for adaptive version(2a2e0c4)
  • fix(timepicker hour face): fix bug which occurs if set 00 hour as default (694ef21), closes (#28)

2.5.1 (2018-08-07)

Fixes

  • fix(timepicker directive): fix bug with wrong output when choose 12h in 24hours format face (d5c9166), closes (#24)

2.5.0 (2018-08-03)

Feature

  • feat(timepicker hours clock face): add 24-hours clock face (f46bb49), closes (#14)

2.4.1 (2018-07-27)

Fixes

  • fix(ngxTimepicker): check value if null, empty or undefined (395188c), closes (#21)

2.4.0 (2018-07-25)

Features

  • feat(ngx-material-timepicker-toggle): add possibility to open timepicker by button (f4b65c9), closes (#13)

2.3.0 (2018-07-24)

Features

  • feat(timepicker): add possibility to set min and max time (e084e28), closes (#13)

2.2.5 (2018-07-10)

Fixes

  • fix(default time): fix bug which occurs when set value in 24-hours format (24e7156)

2.2.4 (2018-07-10)

Fixes

  • fix(timepicker format): change momentJs format to make 24-hours formatting workable (6966dd9), closes (#12)

2.2.3 (2018-07-05)

Fixes

  • fix(default time): move NgxMaterialTimepickerService to component providers, so that each timepicker has its own default time (409b032), closes (#9)
  • fix(focus anchor directive): wrap focusing element in setTimeout to avoid ExpressionChangedAfterItHasBeenCheckedError while using ngModel (f9c86fa), closes (#10)
  • fix(ie): remove css variables, because IE doesn't support it (1fb090f)
  • fix(ie, edge) change X and Y props to left and top in getBoundingClientRect (798bda2)
  • fix(adaptive): fix adaptive for orientation landscape (increase max width) (6eac2ff)

2.2.2 (2018-06-23)

Feature

  • (timepicker): user can change default time with input (571ccb3), closes (#7)
  • refactoring

2.1.2 (2018-05-27)

BREAKING CHANGES

  • upgrade to Angular 6 (252e998), closes (#4) (angular 6 or higher is now required to use this package)

1.1.2 (2018-05-24)

Bug fixes

  • Remove BrowserAnimationsModule from NgxMaterialTimepickerModule imports (2fb6b7d), closes (#3)

1.1.1 (2018-05-16)

Bug fixes

  • Fix error 'cannot find module' which occurs after deploying the previous version

1.1.0 (2018-05-16)

Features

  • add possibility to disable or enable closing popup with ESCAPE button (b2a34bf)
  • add landscape orientation skin (159e8e6)

Bug Fixes

  • timepicker button: add type button to prevent auto submitting a form (2598aa1), closes #1

1.0.0 (2018-03-20)

Initial release