https://github.com/nowzoo/ngx-date-time-inputs
Simple date and time inputs for Angular.
https://github.com/nowzoo/ngx-date-time-inputs
angular date input moment time
Last synced: 10 months ago
JSON representation
Simple date and time inputs for Angular.
- Host: GitHub
- URL: https://github.com/nowzoo/ngx-date-time-inputs
- Owner: nowzoo
- License: mit
- Created: 2018-10-26T19:36:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-26T21:30:18.000Z (over 7 years ago)
- Last Synced: 2025-06-13T04:07:49.463Z (about 1 year ago)
- Topics: angular, date, input, moment, time
- Language: TypeScript
- Homepage: https://nowzoo.github.io/ngx-date-time-inputs/
- Size: 1.04 MB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngx-date-time-inputs
Simple date and time inputs. No calendars or fancy controls or polyfills. They just guess the
date or time the user means. Forgiving and (more or less) locale-aware.
[Demo Site](https://nowzoo.github.io/ngx-date-time-inputs/)
## Installation
Install the library and its dependancies (moment and lodash-es).
```bash
npm i --save @nowzoo/ngx-date-time-inputs moment lodash-es
```
## Usage
Import the library module...
```typescript
import { NgxDateTimeInputsModule } from '@nowzoo/ngx-date-time-inputs';
@NgModule({
imports: [
NgxDateTimeInputsModule
]
})
export class MyModule { }
```
The `ngx-date-input` and `ngx-time-input` components are
now available for you to use:
```html
```
## Date Input API
The component implements `ControlValueAccessor`. The model is a string in the format `YYYY-MM-DD`.
Selector: `ngx-date-input`
Inputs
- `displayFormat: string` The format for displaying the date in the input. See Moment's [formatting docs](https://momentjs.com/docs/#/displaying/format/).
Default: `'LL'` (e.g., September 4, 1986).
- `inputPlaceholder: string` A string to be used as the input's placeholder attribute. Default: `'Enter a date'`
- `inputId: string` A string to be used as the input's id.
- `inputClass: string` A string to be used as the input's class. Pass any error classes here.
## Time Input API
The component implements `ControlValueAccessor`. The model is a string in the format `HH:mm` (24-hour time).
Selector: `ngx-time-input`
Inputs
- `displayFormat: string` The format for displaying the date in the input. See Moment's [formatting docs](https://momentjs.com/docs/#/displaying/format/). Default: `'LT'` (time in the locale).
- `inputPlaceholder: string` A string to be used as the input's placeholder attribute. Default: `'Enter a time'`
- `inputId: string` A string to be used as the input's id.
- `inputClass: string` A string to be used as the input's class. Pass any error classes here.
## Development
Contributions are welcome.
```bash
git clone git@github.com:nowzoo/ngx-date-time-inputs.git
cd ngx-date-time-inputs
npm i
```
This project was generated with [Angular CLI](https://github.com/angular/angular-cli).
The library files are located in `projects/ngx-date-time-inputs`
Run `ng serve` for a dev server with a demo app. Navigate to `http://localhost:4200/`.
### Building the library
Run `ng build ngx-date-time-inputs` to build the library after you change it. The dev server does not rebuild the library automatically.
### Running unit tests
Run `ng test ngx-date-time-inputs` to execute the unit tests via [Karma](https://karma-runner.github.io).
The library is also set up to run tests using Wallaby using the config at `projects/ngx-date-time-inputs/wallaby.js`
## License
[MIT](https://github.com/nowzoo/ngx-date-time-inputs/blob/master/LICENSE)