UNPKG

ngx-cf-date-time-label

Version:

<img src="https://www.codzfun.com/assets/images/logo-icon.png" width="50" height="auto" alt="ng-textarea-enter icon"/>

68 lines (62 loc) 2.31 kB
import { __decorate } from 'tslib'; import { Input, Component, NgModule } from '@angular/core'; import { tz, utc } from 'moment-timezone'; var NgxCfDateTimeLabelComponent = /** @class */ (function () { function NgxCfDateTimeLabelComponent() { this.format = 'YYYY-MM-DD HH:mm:ss'; this.val = ""; this.timeZone = ""; this.formattedValue = this.val; } NgxCfDateTimeLabelComponent.prototype.ngOnInit = function () { }; NgxCfDateTimeLabelComponent.prototype.getFormatedValue = function () { var isoString; if (typeof this.val == 'string') { isoString = this.val; } else if (typeof this.val == 'object' && typeof this.val["toISOString"] == 'function') { isoString = this.val.toISOString(); } if (this.timeZone == "" && typeof tz == 'function') { this.timeZone = tz.guess(); } return this.timeZone && this.timeZone != "" ? utc(isoString).tz(this.timeZone).format(this.format) : utc(isoString).format(this.format); }; __decorate([ Input() ], NgxCfDateTimeLabelComponent.prototype, "format", void 0); __decorate([ Input('value') ], NgxCfDateTimeLabelComponent.prototype, "val", void 0); __decorate([ Input() ], NgxCfDateTimeLabelComponent.prototype, "timeZone", void 0); NgxCfDateTimeLabelComponent = __decorate([ Component({ selector: 'NgxCF-DateTimeLabel', template: "\n <label>{{getFormatedValue()}}</label>\n " }) ], NgxCfDateTimeLabelComponent); return NgxCfDateTimeLabelComponent; }()); var NgxCfDateTimeLabelModule = /** @class */ (function () { function NgxCfDateTimeLabelModule() { } NgxCfDateTimeLabelModule = __decorate([ NgModule({ declarations: [NgxCfDateTimeLabelComponent], imports: [], exports: [NgxCfDateTimeLabelComponent] }) ], NgxCfDateTimeLabelModule); return NgxCfDateTimeLabelModule; }()); /* * Public API Surface of ngx-cf-date-time-label */ /** * Generated bundle index. Do not edit. */ export { NgxCfDateTimeLabelComponent, NgxCfDateTimeLabelModule }; //# sourceMappingURL=ngx-cf-date-time-label.js.map