ngx-cf-date-time-label
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

ng-textarea-enter icon

NgxCF-DateTimeLabel

Display a Date or an ISO string in a required format Supporting all formats provided in momentjs https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/

Also supporting all time zones provided in moment.js https://gist.github.com/diogocapela/12c6617fc87607d11fd62d2a4f42b02a

Demo on stackblitz

[Demo Code on stackblitz] (https://stackblitz.com/edit/ngxcf-datetimelabel?file=src/app/app.component.ts)


Installation

via npm

npm i ngx-cf-date-time-label

then

import { NgxCfDateTimeLabelModule } from 'ngx-cf-date-time-label';


Usage

Use this NgxCF-DateTimeLabel to display date in require formats.

Example - Import packages in your module.

import { NgxCfDateTimeLabelModule } from 'ngx-cf-date-time-label';

@NgModule({
  imports:      [ BrowserModule, FormsModule, NgxCfDateTimeLabelModule ],
  declarations: [ AppComponent, HelloComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

Then Use it inside the html component.

<NgxCF-DateTimeLabel [value]="date" [format]="format" [timeZone]="tz"></NgxCF-DateTimeLabel>

Values in ts file which needs to be bind.

 date = new Date().toISOString();
 format = 'MMMM d, YYYY HH:mm:ss';
 tz = 'Asia/Calcutta';

Options

Inputs

  • value string: Date value in iso formatted string.
  • format string: Supports all momentjs formats look here. Default value is YYYY-MM-DD HH:mm:ss
  • timeZone string: Supports all momentjs Time Zones look here. Default value would be your local time zone.

Contributors

| CodzFun

https://www.codzfun.com/
| | :---: | :---: | :---: |


License

MIT Licensed

Copyright (c) 2020 CodzFun.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.52latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.52
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i ngx-cf-date-time-label

Weekly Downloads

2

Version

0.0.5

License

MIT

Unpacked Size

92.1 kB

Total Files

23

Last publish

Collaborators

  • codzfun