@anglr/rest
Version:
Angular module representing rest services
45 lines • 1.82 kB
JavaScript
import { Inject, Injectable } from '@angular/core';
import { DATE_API } from '@anglr/datetime';
import { DATETIME_STRING_FORMAT } from '../misc/tokens';
import * as i0 from "@angular/core";
/**
* RestDateApi implementation using `@anglr/datetime`
*/
export class DatetimeRestDateApi {
//######################### constructor #########################
constructor(dateApi, stringFormat) {
this.dateApi = dateApi;
this.stringFormat = stringFormat;
}
//######################### public methods #########################
/**
* @inheritdoc
*/
isDate(value) {
return this.dateApi.isDate(value);
}
/**
* @inheritdoc
*/
toString(value) {
return this.dateApi.getValue(value).format(this.stringFormat);
}
/**
* @inheritdoc
*/
isBeforeNow(tested) {
return this.dateApi.now().isAfter(tested);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DatetimeRestDateApi, deps: [{ token: DATE_API }, { token: DATETIME_STRING_FORMAT }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DatetimeRestDateApi }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DatetimeRestDateApi, decorators: [{
type: Injectable
}], ctorParameters: () => [{ type: undefined, decorators: [{
type: Inject,
args: [DATE_API]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [DATETIME_STRING_FORMAT]
}] }] });
//# sourceMappingURL=datetimeRestDateApi.service.js.map