UNPKG

fhirbuilder

Version:
65 lines (64 loc) 2.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Period = void 0; const builders_1 = require("../../builders"); const base_1 = require("../../../core/r4/validators/base"); const Element_1 = require("../base/Element"); /** * @description Time range defined by start and end date/time. * @implements {IPeriod} * @property {string} id - Unique id for inter-element referencing * @property {IExtension[]} extension - Additional content defined by implementations * @property {string} start - Starting time with inclusive boundary * @property {string} end - End time with inclusive boundary, if not ongoing * @property {IElement} _start - Extension of start * @property {IElement} _end - Extension of end * @see {@link https://www.hl7.org/fhir/datatypes.html#Period Period} * @author Roberto Araneda */ class Period extends Element_1.Element { /** * @description Starting time with inclusive boundary * @description A date, date-time or partial date (e.g. just year or year + month) as used in human communication. The format is YYYY, YYYY-MM, YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+zz:zz * @description The time "24:00" is not allowed. * @example 2018, 1973-06, 1905-08-23, 2015-02-07T13:28:17-05:00 or 2017-01-01T00:00:00.000Z */ start; /** * @description End time with inclusive boundary, if not ongoing * @description A date, date-time or partial date (e.g. just year or year + month) as used in human communication. The format is YYYY, YYYY-MM, YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+zz:zz * @example 2018, 1973-06, 1905-08-23, 2015-02-07T13:28:17-05:00 or 2017-01-01T00:00:00.000Z */ end; /** * @description Extension of start */ _start; /** * @description Extension of end */ _end; toJson() { return JSON.parse(JSON.stringify(this)); } toPrettyString() { return `Period${JSON.stringify(this.toJson(), null, 2)}`; } toString() { return `Period${JSON.stringify(this.toJson())}`; } validate() { return (0, base_1.ConformanceValidator)('Period', this); } constructor(args) { super(); Object.assign(this, args); } builderInstance() { return new builders_1.PeriodBuilder(); } serialize() { return JSON.stringify(this.toJson()); } } exports.Period = Period;