UNPKG

fundamental-ngx

Version:

SAP Fiori Fundamentals, implemented in Angular

95 lines 6.12 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { Injectable } from '@angular/core'; import * as i0 from "@angular/core"; /** * @return {?} */ export function DATE_TIME_FORMAT_FACTORY() { return new DateTimeFormatParserDefault(); } /** * Abstract class which defines the behaviour of the datetime format and parser. * @abstract */ var DateTimeFormatParser = /** @class */ (function () { function DateTimeFormatParser() { } DateTimeFormatParser.decorators = [ { type: Injectable, args: [{ providedIn: 'root', useFactory: DATE_TIME_FORMAT_FACTORY },] } ]; /** @nocollapse */ DateTimeFormatParser.ngInjectableDef = i0.defineInjectable({ factory: DATE_TIME_FORMAT_FACTORY, token: DateTimeFormatParser, providedIn: "root" }); return DateTimeFormatParser; }()); export { DateTimeFormatParser }; if (false) { /** * Should take in a string value and return a date object. * @abstract * @param {?} value String to concert to a date object. * @return {?} */ DateTimeFormatParser.prototype.parse = function (value) { }; /** * Should take in a date object and return a string representation. * @abstract * @param {?} date String to concert to a date object. * @return {?} */ DateTimeFormatParser.prototype.format = function (date) { }; } /** * Default implementation of the DateFormatParser service. */ var DateTimeFormatParserDefault = /** @class */ (function (_super) { tslib_1.__extends(DateTimeFormatParserDefault, _super); function DateTimeFormatParserDefault() { return _super !== null && _super.apply(this, arguments) || this; } /** * Takes in a string representation of a date and returns a Date object. * @param value String to convert to a date. */ /** * Takes in a string representation of a date and returns a Date object. * @param {?} value String to convert to a date. * @return {?} */ DateTimeFormatParserDefault.prototype.parse = /** * Takes in a string representation of a date and returns a Date object. * @param {?} value String to convert to a date. * @return {?} */ function (value) { return new Date(value); }; /** * Takes in a date object and returns the string representation. * @param date Date object to convert to a string. */ /** * Takes in a date object and returns the string representation. * @param {?} date Date object to convert to a string. * @return {?} */ DateTimeFormatParserDefault.prototype.format = /** * Takes in a date object and returns the string representation. * @param {?} date Date object to convert to a string. * @return {?} */ function (date) { return date.toLocaleString(); }; DateTimeFormatParserDefault.decorators = [ { type: Injectable } ]; return DateTimeFormatParserDefault; }(DateTimeFormatParser)); export { DateTimeFormatParserDefault }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZXRpbWUtcGFyc2VyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vZnVuZGFtZW50YWwtbmd4LyIsInNvdXJjZXMiOlsibGliL2RhdGV0aW1lLXBpY2tlci9mb3JtYXQvZGF0ZXRpbWUtcGFyc2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7Ozs7QUFFM0MsTUFBTSxVQUFVLHdCQUF3QjtJQUNwQyxPQUFPLElBQUksMkJBQTJCLEVBQUUsQ0FBQztBQUM3QyxDQUFDOzs7OztBQUtEO0lBQUE7S0FpQkM7O2dCQWpCQSxVQUFVLFNBQUM7b0JBQ1IsVUFBVSxFQUFFLE1BQU07b0JBQ2xCLFVBQVUsRUFBRSx3QkFBd0I7aUJBQ3ZDOzs7K0JBWkQ7Q0EwQkMsQUFqQkQsSUFpQkM7U0FicUIsb0JBQW9COzs7Ozs7OztJQU10Qyw0REFBb0M7Ozs7Ozs7SUFNcEMsNERBQW9DOzs7OztBQU14QztJQUNpRCx1REFBb0I7SUFEckU7O0lBa0JBLENBQUM7SUFmRzs7O09BR0c7Ozs7OztJQUNJLDJDQUFLOzs7OztJQUFaLFVBQWEsS0FBYTtRQUN0QixPQUFPLElBQUksSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQzNCLENBQUM7SUFFRDs7O09BR0c7Ozs7OztJQUNJLDRDQUFNOzs7OztJQUFiLFVBQWMsSUFBVTtRQUNwQixPQUFPLElBQUksQ0FBQyxjQUFjLEVBQUUsQ0FBQztJQUNqQyxDQUFDOztnQkFqQkosV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