ngx-cf-date-time-label
v0.0.5
Published
<img src="https://www.codzfun.com/assets/images/logo-icon.png" width="50" height="auto" alt="ng-textarea-enter icon"/>
Downloads
8
Maintainers
Readme
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 isYYYY-MM-DD HH:mm:ss
- timeZone
string
: Supports all momentjs Time Zones look here. Default value would be your local time zone.
Contributors
| CodzFunhttps://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.