UNPKG

angular-dayjs

Version:

2KB immutable date time library alternative to Moment.js with the same modern API

73 lines (63 loc) 2.81 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('dayjs'), require('dayjs/plugin/relativeTime')) : typeof define === 'function' && define.amd ? define('angular-dayjs', ['exports', '@angular/core', 'dayjs', 'dayjs/plugin/relativeTime'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['angular-dayjs'] = {}, global.ng.core, global.dayjs, global.relativeTime)); }(this, (function (exports, i0, dayjs, relativeTime) { 'use strict'; function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n['default'] = e; return Object.freeze(n); } var dayjs__namespace = /*#__PURE__*/_interopNamespace(dayjs); var relativeTime__namespace = /*#__PURE__*/_interopNamespace(relativeTime); var AngularDayjsService = /** @class */ (function () { function AngularDayjsService() { dayjs.extend(relativeTime__namespace); } AngularDayjsService.prototype.timeAgo = function (timestamp) { return dayjs__namespace().to(dayjs__namespace(timestamp)); }; return AngularDayjsService; }()); AngularDayjsService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AngularDayjsService_Factory() { return new AngularDayjsService(); }, token: AngularDayjsService, providedIn: "root" }); AngularDayjsService.decorators = [ { type: i0.Injectable, args: [{ providedIn: 'root', },] } ]; AngularDayjsService.ctorParameters = function () { return []; }; var AngularDayjsModule = /** @class */ (function () { function AngularDayjsModule() { } return AngularDayjsModule; }()); AngularDayjsModule.decorators = [ { type: i0.NgModule, args: [{ providers: [AngularDayjsService], },] } ]; /* * Public API Surface of angular-dayjs */ /** * Generated bundle index. Do not edit. */ exports.AngularDayjsModule = AngularDayjsModule; exports.AngularDayjsService = AngularDayjsService; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=angular-dayjs.umd.js.map