@anglr/datetime 3.0.0 → 3.0.1-beta.20220525100833
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +14 -2
- package/date-fns/src/misc/tokens.d.ts +6 -2
- package/date-fns/src/misc/tokens.d.ts.map +1 -1
- package/date-fns/src/services/dateFnsDateApi.service.d.ts +303 -2
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/es2015/date-fns/src/misc/tokens.js +10 -2
- package/es2015/date-fns/src/misc/tokens.js.map +1 -1
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js +17 -9
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2015/moment/src/misc/tokens.js +9 -1
- package/es2015/moment/src/misc/tokens.js.map +1 -1
- package/es2015/moment/src/services/momentDateApi.service.js +15 -7
- package/es2015/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2015/src/misc/tokens.js +4 -0
- package/es2015/src/misc/tokens.js.map +1 -1
- package/es2015/src/services/dateApi.interface.js.map +1 -1
- package/es2020/date-fns/src/misc/tokens.js +10 -2
- package/es2020/date-fns/src/misc/tokens.js.map +1 -1
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js +17 -9
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2020/moment/src/misc/tokens.js +9 -1
- package/es2020/moment/src/misc/tokens.js.map +1 -1
- package/es2020/moment/src/services/momentDateApi.service.js +15 -7
- package/es2020/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2020/src/misc/tokens.js +4 -0
- package/es2020/src/misc/tokens.js.map +1 -1
- package/es2020/src/services/dateApi.interface.js.map +1 -1
- package/moment/src/misc/tokens.d.ts +5 -1
- package/moment/src/misc/tokens.d.ts.map +1 -1
- package/moment/src/services/momentDateApi.service.d.ts +302 -2
- package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/misc/tokens.d.ts +5 -1
- package/src/misc/tokens.d.ts.map +1 -1
- package/src/services/dateApi.interface.d.ts +6 -0
- package/src/services/dateApi.interface.d.ts.map +1 -1
- package/version.bak +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateFnsDateApi.service.js","sourceRoot":"","sources":["../../../../date-fns/src/services/dateFnsDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAoC,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAExmB,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;;;AAG/C;;GAEG;AACH,MAAM,oBAAoB;IAgCtB,iEAAiE;IACj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;OAEG;IACI,aAAa;QAEhB,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAQ,CAAC,YAAa,CAAC;QAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EACzB;YACI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAS,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;SAC3F;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAc;QAExB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;;2GArGQ,cAAc,kBAGH,eAAe;+GAH1B,cAAc;2FAAd,cAAc;kBAD1B,UAAU;;0BAIM,MAAM;2BAAC,eAAe","sourcesContent":["import {Inject, Injectable} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser} from '@anglr/datetime';\nimport {isBlank, isPresent, isString} from '@jscrpt/common';\nimport {toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay, subHours, addHours, endOfHour, startOfHour, startOfMinute, endOfMinute, addMinutes, subMinutes, getHours, setHours, getMinutes, setMinutes, isDate} from 'date-fns';\n\nimport {DATE_FNS_LOCALE} from '../misc/tokens';\nimport {DateFnsLocale} from './dateFnsLocale.service';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nclass DateFnsDateApiObject implements DateApiObject<Date>\n{\n //######################### private fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n private _originalValue: Date;\n\n /**\n * Instance of date\n */\n private _value: Date;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): Date\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): Date\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|Date,\n protected _localeSvc: DateFnsLocale,\n format?: string)\n {\n if(isString(value))\n {\n //ISO string\n if(/^\\d+-\\d+-\\d+(T\\d+:\\d+:\\d+)?/.test(value))\n {\n this._value = this._originalValue = parseISO(value);\n }\n else\n {\n if(isBlank(format))\n {\n throw new Error('date-fns requires format parameter to be set for parsing non ISO string date!');\n }\n\n this._value = this._originalValue = parse(value, format, new Date(1970, 0));\n }\n }\n else\n {\n this._value = this._originalValue = toDate(value);\n }\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return isValid(this._value);\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n return isWeekend(this._value);\n }\n\n /**\n * Formats date value\n * @param formatString - Format token used for creating formatted string\n */\n public format(formatString: string): string\n {\n return format(this._value, formatString, {locale: this._localeSvc.locale});\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<Date>\n {\n this._value = startOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<Date>\n {\n this._value = endOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<Date>\n {\n this._value = startOfYear(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<Date>\n {\n this._value = endOfYear(this._value);\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<Date>\n {\n this._value = addYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<Date>\n {\n this._value = subYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<Date>\n {\n this._value = startOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<Date>\n {\n this._value = endOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<Date>\n {\n this._value = addMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<Date>\n {\n this._value = subMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<Date>\n {\n this._value = startOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<Date>\n {\n this._value = endOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<Date>\n {\n this._value = addWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<Date>\n {\n this._value = subWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<Date>\n {\n this._value = startOfDay(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<Date>\n {\n this._value = endOfDay(this._value);\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<Date>\n {\n this._value = addDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<Date>\n {\n this._value = subDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<Date>\n {\n this._value = startOfHour(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<Date>\n {\n this._value = endOfHour(this._value);\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<Date>\n {\n this._value = addHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<Date>\n {\n this._value = subHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<Date>\n {\n this._value = startOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<Date>\n {\n this._value = endOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<Date>\n {\n this._value = addMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<Date>\n {\n this._value = subMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return getDaysInMonth(this._value);\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<Date>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<Date>|number\n {\n if(isPresent(year))\n {\n this._value = setYear(this._value, year);\n\n return this;\n }\n\n return getYear(this._value);\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<Date>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<Date>|number\n {\n if(isPresent(month))\n {\n this._value = setMonth(this._value, month);\n\n return this;\n }\n\n return getMonth(this._value);\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<Date>|number\n {\n if(isPresent(day))\n {\n this._value = setDate(this._value, day);\n\n return this;\n }\n\n return getDate(this._value);\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<Date>\n {\n if(isPresent(day))\n {\n this._value = setISODay(this._value, day + 1!);\n\n return this;\n }\n\n return getISODay(this._value) - 1;\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero based\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<Date>;\n /**\n * Gets or sets hours zero based\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<Date>|number\n {\n if(isPresent(hour))\n {\n this._value = setHours(this._value, hour);\n\n return this;\n }\n\n return getHours(this._value);\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<Date>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<Date>|number\n {\n if(isPresent(minute))\n {\n this._value = setMinutes(this._value, minute);\n\n return this;\n }\n\n return getMinutes(this._value);\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: Date): boolean\n {\n return isBefore(this._value, date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: Date): boolean\n {\n return isAfter(this._value, date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: Date): number\n {\n return differenceInCalendarDays(this._value, date);\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: Date): boolean\n {\n return isSameWeek(this._value, date, {locale: this._localeSvc.locale});\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: Date): boolean\n {\n const year = getYear(this._value);\n const start = year - (year % 10);\n const end = start + 10;\n\n return getYear(date) >= start && getYear(date) < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: Date): boolean\n {\n return isSameYear(this._value, date);\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: Date): boolean\n {\n return isSameMonth(this._value, date);\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: Date): boolean\n {\n return isSameDay(this._value, date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._value), this._localeSvc);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._originalValue), this._localeSvc);\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: Date): DateApiObject<Date>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<Date>\n {\n this._value = this._originalValue;\n\n return this;\n }\n}\n\n/**\n * Date api using DateFnsJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class DateFnsDateApi implements DateApi<Date>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_FNS_LOCALE) protected _localeSvc: DateFnsLocale,\n protected _relativeParser: DateTimeRelativeParser<Date>)\n {\n }\n\n //######################### public methods - implementation of DateApi #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|Date, format?: string): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(this._relativeParser.parse(value), this._localeSvc, format);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(), this._localeSvc);\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^p+$/i.test(pseudoFormat))\n {\n if(!this._localeSvc.locale.formatLong)\n {\n throw new Error('Missing long formats for locale in DateApi');\n }\n\n const widths: {[index: number]: string} =\n {\n 1: 'short',\n 2: 'medium',\n 3: 'long',\n 4: 'full'\n };\n\n //date time format\n if(pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8)\n {\n const partLength = pseudoFormat.length / 2;\n\n return `${this._localeSvc.locale.formatLong.date({width: widths[partLength]})} ${this._localeSvc.locale.formatLong.time({width: widths[partLength]})}`;\n }\n //date format\n else if(pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.date({width: widths[pseudoFormat.length]});\n }\n //time format\n else if(pseudoFormat.indexOf('p') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.time({width: widths[pseudoFormat.length]});\n }\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return this._localeSvc.locale.options?.weekStartsOn === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n let startIndex = this._localeSvc.locale.options!.weekStartsOn!;\n const weekdays: string[] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekdays.push(this._localeSvc.locale.localize!.day(startIndex++ % 7, {width: 'short'}));\n }\n\n return weekdays;\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is Date\n {\n return isDate(value);\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"dateFnsDateApi.service.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IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAQ,CAAC,YAAa,CAAC;QAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EACzB;YACI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAS,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;SAC3F;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAc;QAExB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;;2GAtGQ,cAAc,kBAGH,eAAe,mDAEf,oBAAoB;+GAL/B,cAAc;2FAAd,cAAc;kBAD1B,UAAU;;0BAIM,MAAM;2BAAC,eAAe;;0BAEtB,MAAM;2BAAC,oBAAoB;;AAoG5C;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAkD,oBAAoB,CAAC","sourcesContent":["import {Inject, Injectable} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor, DATE_API_OBJECT_TYPE} from '@anglr/datetime';\nimport {isBlank, isPresent, isString} from '@jscrpt/common';\nimport {toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay, subHours, addHours, endOfHour, startOfHour, startOfMinute, endOfMinute, addMinutes, subMinutes, getHours, setHours, getMinutes, setMinutes, isDate} from 'date-fns';\n\nimport {DATE_FNS_LOCALE} from '../misc/tokens';\nimport {DateFnsLocale} from './dateFnsLocale.service';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nclass DateFnsDateApiObject implements DateApiObject<Date>\n{\n //######################### protected fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n protected _originalValue: Date;\n\n /**\n * Instance of date\n */\n protected _value: Date;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): Date\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): Date\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|Date,\n format: string|null|undefined,\n protected _localeSvc: DateFnsLocale)\n {\n if(isString(value))\n {\n //ISO string\n if(/^\\d+-\\d+-\\d+(T\\d+:\\d+:\\d+)?/.test(value))\n {\n this._value = this._originalValue = parseISO(value);\n }\n else\n {\n if(isBlank(format))\n {\n throw new Error('date-fns requires format parameter to be set for parsing non ISO string date!');\n }\n\n this._value = this._originalValue = parse(value, format, new Date(1970, 0));\n }\n }\n else\n {\n this._value = this._originalValue = toDate(value);\n }\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return isValid(this._value);\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n return isWeekend(this._value);\n }\n\n /**\n * Formats date value\n * @param formatString - Format token used for creating formatted string\n */\n public format(formatString: string): string\n {\n return format(this._value, formatString, {locale: this._localeSvc.locale});\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<Date>\n {\n this._value = startOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<Date>\n {\n this._value = endOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<Date>\n {\n this._value = startOfYear(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<Date>\n {\n this._value = endOfYear(this._value);\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<Date>\n {\n this._value = addYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<Date>\n {\n this._value = subYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<Date>\n {\n this._value = startOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<Date>\n {\n this._value = endOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<Date>\n {\n this._value = addMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<Date>\n {\n this._value = subMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<Date>\n {\n this._value = startOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<Date>\n {\n this._value = endOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<Date>\n {\n this._value = addWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<Date>\n {\n this._value = subWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<Date>\n {\n this._value = startOfDay(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<Date>\n {\n this._value = endOfDay(this._value);\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<Date>\n {\n this._value = addDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<Date>\n {\n this._value = subDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<Date>\n {\n this._value = startOfHour(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<Date>\n {\n this._value = endOfHour(this._value);\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<Date>\n {\n this._value = addHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<Date>\n {\n this._value = subHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<Date>\n {\n this._value = startOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<Date>\n {\n this._value = endOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<Date>\n {\n this._value = addMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<Date>\n {\n this._value = subMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return getDaysInMonth(this._value);\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<Date>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<Date>|number\n {\n if(isPresent(year))\n {\n this._value = setYear(this._value, year);\n\n return this;\n }\n\n return getYear(this._value);\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<Date>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<Date>|number\n {\n if(isPresent(month))\n {\n this._value = setMonth(this._value, month);\n\n return this;\n }\n\n return getMonth(this._value);\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<Date>|number\n {\n if(isPresent(day))\n {\n this._value = setDate(this._value, day);\n\n return this;\n }\n\n return getDate(this._value);\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<Date>\n {\n if(isPresent(day))\n {\n this._value = setISODay(this._value, day + 1!);\n\n return this;\n }\n\n return getISODay(this._value) - 1;\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero based\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<Date>;\n /**\n * Gets or sets hours zero based\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<Date>|number\n {\n if(isPresent(hour))\n {\n this._value = setHours(this._value, hour);\n\n return this;\n }\n\n return getHours(this._value);\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<Date>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<Date>|number\n {\n if(isPresent(minute))\n {\n this._value = setMinutes(this._value, minute);\n\n return this;\n }\n\n return getMinutes(this._value);\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: Date): boolean\n {\n return isBefore(this._value, date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: Date): boolean\n {\n return isAfter(this._value, date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: Date): number\n {\n return differenceInCalendarDays(this._value, date);\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: Date): boolean\n {\n return isSameWeek(this._value, date, {locale: this._localeSvc.locale});\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: Date): boolean\n {\n const year = getYear(this._value);\n const start = year - (year % 10);\n const end = start + 10;\n\n return getYear(date) >= start && getYear(date) < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: Date): boolean\n {\n return isSameYear(this._value, date);\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: Date): boolean\n {\n return isSameMonth(this._value, date);\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: Date): boolean\n {\n return isSameDay(this._value, date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._value), null, this._localeSvc);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._originalValue), null, this._localeSvc);\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: Date): DateApiObject<Date>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<Date>\n {\n this._value = this._originalValue;\n\n return this;\n }\n}\n\n/**\n * Date api using DateFnsJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class DateFnsDateApi implements DateApi<Date>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_FNS_LOCALE) protected _localeSvc: DateFnsLocale,\n protected _relativeParser: DateTimeRelativeParser<Date>,\n @Inject(DATE_API_OBJECT_TYPE) protected _dateApiObjecType: DateApiObjectCtor<DateFnsDateApiObject, Date>)\n {\n }\n\n //######################### public methods - implementation of DateApi #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|Date, format?: string): DateApiObject<Date>\n {\n return new this._dateApiObjecType(this._relativeParser.parse(value), format, this._localeSvc);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<Date>\n {\n return new this._dateApiObjecType(new Date(), null, this._localeSvc);\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^p+$/i.test(pseudoFormat))\n {\n if(!this._localeSvc.locale.formatLong)\n {\n throw new Error('Missing long formats for locale in DateApi');\n }\n\n const widths: {[index: number]: string} =\n {\n 1: 'short',\n 2: 'medium',\n 3: 'long',\n 4: 'full'\n };\n\n //date time format\n if(pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8)\n {\n const partLength = pseudoFormat.length / 2;\n\n return `${this._localeSvc.locale.formatLong.date({width: widths[partLength]})} ${this._localeSvc.locale.formatLong.time({width: widths[partLength]})}`;\n }\n //date format\n else if(pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.date({width: widths[pseudoFormat.length]});\n }\n //time format\n else if(pseudoFormat.indexOf('p') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.time({width: widths[pseudoFormat.length]});\n }\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return this._localeSvc.locale.options?.weekStartsOn === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n let startIndex = this._localeSvc.locale.options!.weekStartsOn!;\n const weekdays: string[] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekdays.push(this._localeSvc.locale.localize!.day(startIndex++ % 7, {width: 'short'}));\n }\n\n return weekdays;\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is Date\n {\n return isDate(value);\n }\n}\n\n/**\n * Type that represents creation of DateApiObject for date-fns\n */\nexport const dateFnsDateApiObjectType: DateApiObjectCtor<DateFnsDateApiObject, Date> = DateFnsDateApiObject;"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FORMAT_PROVIDER } from '@anglr/datetime';
|
|
1
|
+
import { DATE_API_OBJECT_TYPE, FORMAT_PROVIDER } from '@anglr/datetime';
|
|
2
|
+
import { momentDateApiObjectType } from '../services/momentDateApi.service';
|
|
2
3
|
/**
|
|
3
4
|
* Injection token used for obtaining moment FormatProvider implementation
|
|
4
5
|
*/
|
|
@@ -23,4 +24,11 @@ export const MOMENT_FORMAT_PROVIDER = {
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Injection token used for injecting type that creates instance of DateApiObject for moment
|
|
29
|
+
*/
|
|
30
|
+
export const MOMENT_DATE_API_OBJECT_TYPE = {
|
|
31
|
+
provide: DATE_API_OBJECT_TYPE,
|
|
32
|
+
useClass: momentDateApiObjectType
|
|
33
|
+
};
|
|
26
34
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../moment/src/misc/tokens.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../moment/src/misc/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAkB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAC,uBAAuB,EAAC,MAAM,mCAAmC,CAAC;AAE1E;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACnC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACxC;IACI,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,uBAAuB;CACpC,CAAC","sourcesContent":["import {ClassProvider, FactoryProvider} from '@angular/core';\nimport {DATE_API_OBJECT_TYPE, FormatProvider, FORMAT_PROVIDER} from '@anglr/datetime';\n\nimport {momentDateApiObjectType} from '../services/momentDateApi.service';\n\n/**\n * Injection token used for obtaining moment FormatProvider implementation\n */\nexport const MOMENT_FORMAT_PROVIDER: FactoryProvider =\n{\n provide: FORMAT_PROVIDER,\n useFactory: () =>\n {\n return <FormatProvider>{\n date: 'L',\n dateTime: 'L LT',\n time: 'LT',\n year: 'YYYY',\n month: 'MM',\n week: 'ww',\n day: 'DD',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'dddd',\n dayNameShort: 'dd',\n monthName: 'MMMM',\n monthNameShort: 'MMM'\n };\n }\n};\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject for moment\n */\nexport const MOMENT_DATE_API_OBJECT_TYPE: ClassProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useClass: momentDateApiObjectType\n};"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { DateTimeRelativeParser } from '@anglr/datetime';
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
|
+
import { DateTimeRelativeParser, DATE_API_OBJECT_TYPE } from '@anglr/datetime';
|
|
3
3
|
import { isBlank, isPresent } from '@jscrpt/common';
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
@@ -439,8 +439,9 @@ class MomentDateApiObject {
|
|
|
439
439
|
*/
|
|
440
440
|
export class MomentDateApi {
|
|
441
441
|
//######################### constructor #########################
|
|
442
|
-
constructor(_relativeParser) {
|
|
442
|
+
constructor(_relativeParser, _dateApiObjecType) {
|
|
443
443
|
this._relativeParser = _relativeParser;
|
|
444
|
+
this._dateApiObjecType = _dateApiObjecType;
|
|
444
445
|
}
|
|
445
446
|
//######################### public methods #########################
|
|
446
447
|
/**
|
|
@@ -449,13 +450,13 @@ export class MomentDateApi {
|
|
|
449
450
|
* @param format - Format string used for parsing string value
|
|
450
451
|
*/
|
|
451
452
|
getValue(value, format) {
|
|
452
|
-
return new
|
|
453
|
+
return new this._dateApiObjecType(this._relativeParser.parse(value), format);
|
|
453
454
|
}
|
|
454
455
|
/**
|
|
455
456
|
* Gets wrapping object used for manipulation instantiated to current date and time
|
|
456
457
|
*/
|
|
457
458
|
now() {
|
|
458
|
-
return new
|
|
459
|
+
return new this._dateApiObjecType(moment());
|
|
459
460
|
}
|
|
460
461
|
/**
|
|
461
462
|
* Gets format string using pseudo format
|
|
@@ -486,9 +487,16 @@ export class MomentDateApi {
|
|
|
486
487
|
return value instanceof moment;
|
|
487
488
|
}
|
|
488
489
|
}
|
|
489
|
-
MomentDateApi.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: MomentDateApi, deps: [{ token: i1.DateTimeRelativeParser }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
490
|
+
MomentDateApi.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: MomentDateApi, deps: [{ token: i1.DateTimeRelativeParser }, { token: DATE_API_OBJECT_TYPE }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
490
491
|
MomentDateApi.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: MomentDateApi });
|
|
491
492
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: MomentDateApi, decorators: [{
|
|
492
493
|
type: Injectable
|
|
493
|
-
}], ctorParameters: function () { return [{ type: i1.DateTimeRelativeParser }
|
|
494
|
+
}], ctorParameters: function () { return [{ type: i1.DateTimeRelativeParser }, { type: undefined, decorators: [{
|
|
495
|
+
type: Inject,
|
|
496
|
+
args: [DATE_API_OBJECT_TYPE]
|
|
497
|
+
}] }]; } });
|
|
498
|
+
/**
|
|
499
|
+
* Type that represents creation of DateApiObject for moment
|
|
500
|
+
*/
|
|
501
|
+
export const momentDateApiObjectType = MomentDateApiObject;
|
|
494
502
|
//# sourceMappingURL=momentDateApi.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"momentDateApi.service.js","sourceRoot":"","sources":["../../../../moment/src/services/momentDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAoC,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,MAA2B,MAAM,QAAQ,CAAC;;;AAEjD;;GAEG;AACH,MAAM,mBAAmB;IAgCrB,iEAAiE;IACjE,YAAY,KAA8B,EAAE,MAAe;QAEvD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAtBD,yGAAyG;IAEzG;;OAEG;IACH,IAAW,aAAa;QAEpB,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IAC9E,CAAC;IAED;;OAEG;IACI,GAAG;QAEN,OAAO,IAAI,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,YAAoB;QAEjC,IAAG,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,EAC/C;YACI,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,GAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrH;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,kBAAkB;QAErB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,aAAa;QAEhB,OAAO,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAc;QAExB,OAAO,KAAK,YAAY,MAAM,CAAC;IACnC,CAAC;;0GA/DQ,aAAa;8GAAb,aAAa;2FAAb,aAAa;kBADzB,UAAU","sourcesContent":["import {Injectable} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser} from '@anglr/datetime';\nimport {isBlank, isPresent} from '@jscrpt/common';\nimport moment, {LongDateFormatKey} from 'moment';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nclass MomentDateApiObject implements DateApiObject<moment.Moment>\n{\n //######################### private fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n private _originalValue: moment.Moment;\n\n /**\n * Instance of date\n */\n private _value: moment.Moment;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): moment.Moment\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): moment.Moment\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|moment.Moment, format?: string)\n {\n this._value = this._originalValue = moment(value, format);\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return this._value.isValid();\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n const weekday = this._value.isoWeekday();\n\n return weekday == 6 || weekday == 7;\n }\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n public format(format: string): string\n {\n return this._value.format(format.replace(/y/g, 'Y').replace(/d/g, 'D'));\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = (this._value.year() % 10);\n\n this._value = moment(this._value).subtract(diff, 'years').startOf('year');\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = 9 - (this._value.year() % 10);\n\n this._value = moment(this._value).add(diff, 'years').endOf('year');\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('year');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('year');\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('month');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('month');\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('week');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('week');\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('day');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('day');\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('hour');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('hour');\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('minute');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('minute');\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return this._value.daysInMonth();\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(year))\n {\n this._value = moment(this._value).year(year);\n\n return this;\n }\n\n return this._value.year();\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<moment.Moment>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(month))\n {\n this._value = moment(this._value).month(month);\n\n return this;\n }\n\n return this._value.month();\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).date(day);\n\n return this;\n }\n\n return this._value.date();\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<moment.Moment>\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).weekday(day);\n\n return this;\n }\n\n return this._value.weekday();\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(hour))\n {\n this._value = moment(this._value).hours(hour);\n\n return this;\n }\n\n return this._value.hours();\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(minute))\n {\n this._value = moment(this._value).minutes(minute);\n\n return this;\n }\n\n return this._value.minutes();\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: moment.Moment): boolean\n {\n return this._value.isBefore(date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: moment.Moment): boolean\n {\n return this._value.isAfter(date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: moment.Moment): number\n {\n return moment(this._value).startOf('day').diff(moment(date).startOf('day'), 'days');\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'week');\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: moment.Moment): boolean\n {\n const year = this._value.year();\n const start = year - (year % 10);\n const end = start + 10;\n\n return date.year() >= start && date.year() < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'year');\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'month');\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'day');\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._value));\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._originalValue));\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: moment.Moment): DateApiObject<moment.Moment>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<moment.Moment>\n {\n this._value = this._originalValue;\n\n return this;\n }\n}\n\n/**\n * Date api using MomentJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class MomentDateApi implements DateApi<moment.Moment>\n{\n //######################### constructor #########################\n constructor(protected _relativeParser: DateTimeRelativeParser<moment.Moment>)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|moment.Moment, format?: string): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(this._relativeParser.parse(value), format);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment());\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^((LT|LTS|L+|l+)\\s*)*$/g.test(pseudoFormat))\n {\n return pseudoFormat.split(' ').map(itm => moment.localeData().longDateFormat(itm as LongDateFormatKey)).join(' ');\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return moment.localeData().firstDayOfWeek() === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n return moment.weekdaysShort(true);\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is moment.Moment\n {\n return value instanceof moment;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"momentDateApi.service.js","sourceRoot":"","sources":["../../../../moment/src/services/momentDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAoC,sBAAsB,EAAqB,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AACnI,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,MAA2B,MAAM,QAAQ,CAAC;;;AAEjD;;GAEG;AACH,MAAM,mBAAmB;IAgCrB,iEAAiE;IACjE,YAAY,KAA8B,EAAE,MAAe;QAEvD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAtBD,yGAAyG;IAEzG;;OAEG;IACH,IAAW,aAAa;QAEpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QAEZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAQD,sGAAsG;IAEtG;;OAEG;IACI,OAAO;QAEV,OAAO,IAAI,CAAC,M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AGG;IACI,SAAS,CAAC,YAAoB;QAEjC,IAAG,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,EAC/C;YACI,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,GAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrH;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,kBAAkB;QAErB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,aAAa;QAEhB,OAAO,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAc;QAExB,OAAO,KAAK,YAAY,MAAM,CAAC;IACnC,CAAC;;0GAhEQ,aAAa,wDAIF,oBAAoB;8GAJ/B,aAAa;2FAAb,aAAa;kBADzB,UAAU;;0BAKM,MAAM;2BAAC,oBAAoB;;AA+D5C;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA0D,mBAAmB,CAAC","sourcesContent":["import {Inject, Injectable} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor, DATE_API_OBJECT_TYPE} from '@anglr/datetime';\nimport {isBlank, isPresent} from '@jscrpt/common';\nimport moment, {LongDateFormatKey} from 'moment';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nclass MomentDateApiObject implements DateApiObject<moment.Moment>\n{\n //######################### protected fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n protected _originalValue: moment.Moment;\n\n /**\n * Instance of date\n */\n protected _value: moment.Moment;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): moment.Moment\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): moment.Moment\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|moment.Moment, format?: string)\n {\n this._value = this._originalValue = moment(value, format);\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return this._value.isValid();\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n const weekday = this._value.isoWeekday();\n\n return weekday == 6 || weekday == 7;\n }\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n public format(format: string): string\n {\n return this._value.format(format.replace(/y/g, 'Y').replace(/d/g, 'D'));\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = (this._value.year() % 10);\n\n this._value = moment(this._value).subtract(diff, 'years').startOf('year');\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = 9 - (this._value.year() % 10);\n\n this._value = moment(this._value).add(diff, 'years').endOf('year');\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('year');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('year');\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('month');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('month');\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('week');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('week');\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('day');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('day');\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('hour');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('hour');\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('minute');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('minute');\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return this._value.daysInMonth();\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(year))\n {\n this._value = moment(this._value).year(year);\n\n return this;\n }\n\n return this._value.year();\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<moment.Moment>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(month))\n {\n this._value = moment(this._value).month(month);\n\n return this;\n }\n\n return this._value.month();\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).date(day);\n\n return this;\n }\n\n return this._value.date();\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<moment.Moment>\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).weekday(day);\n\n return this;\n }\n\n return this._value.weekday();\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(hour))\n {\n this._value = moment(this._value).hours(hour);\n\n return this;\n }\n\n return this._value.hours();\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(minute))\n {\n this._value = moment(this._value).minutes(minute);\n\n return this;\n }\n\n return this._value.minutes();\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: moment.Moment): boolean\n {\n return this._value.isBefore(date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: moment.Moment): boolean\n {\n return this._value.isAfter(date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: moment.Moment): number\n {\n return moment(this._value).startOf('day').diff(moment(date).startOf('day'), 'days');\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'week');\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: moment.Moment): boolean\n {\n const year = this._value.year();\n const start = year - (year % 10);\n const end = start + 10;\n\n return date.year() >= start && date.year() < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'year');\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'month');\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: moment.Moment): boolean\n {\n return this._value.isSame(date, 'day');\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._value));\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._originalValue));\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: moment.Moment): DateApiObject<moment.Moment>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<moment.Moment>\n {\n this._value = this._originalValue;\n\n return this;\n }\n}\n\n/**\n * Date api using MomentJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class MomentDateApi implements DateApi<moment.Moment>\n{\n //######################### constructor #########################\n constructor(protected _relativeParser: DateTimeRelativeParser<moment.Moment>,\n @Inject(DATE_API_OBJECT_TYPE) protected _dateApiObjecType: DateApiObjectCtor<MomentDateApiObject, moment.Moment>)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|moment.Moment, format?: string): DateApiObject<moment.Moment>\n {\n return new this._dateApiObjecType(this._relativeParser.parse(value), format);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<moment.Moment>\n {\n return new this._dateApiObjecType(moment());\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^((LT|LTS|L+|l+)\\s*)*$/g.test(pseudoFormat))\n {\n return pseudoFormat.split(' ').map(itm => moment.localeData().longDateFormat(itm as LongDateFormatKey)).join(' ');\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return moment.localeData().firstDayOfWeek() === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n return moment.weekdaysShort(true);\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is moment.Moment\n {\n return value instanceof moment;\n }\n}\n\n/**\n * Type that represents creation of DateApiObject for moment\n */\nexport const momentDateApiObjectType: DateApiObjectCtor<MomentDateApiObject, moment.Moment> = MomentDateApiObject;"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Injection token used for injecting type that creates instance of DateApiObject
|
|
4
|
+
*/
|
|
5
|
+
export const DATE_API_OBJECT_TYPE = new InjectionToken('DATE_API_OBJECT_TYPE');
|
|
2
6
|
/**
|
|
3
7
|
* Injection token used for obtaining DateApi implementation
|
|
4
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAI7C;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B,IAAI,cAAc,CAAU,UAAU,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC,IAAI,cAAc,CAAiB,iBAAiB,EACjB;IACI,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,GAAG,EAAE;QAEV,OAAO;YACH,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\n\nimport {DateApi, FormatProvider} from '../services';\n\n/**\n * Injection token used for obtaining DateApi implementation\n */\nexport const DATE_API: InjectionToken<DateApi> = new InjectionToken<DateApi>('DATE_API');\n\n/**\n * Injection token used for obtaining FormatProvider implementation\n */\nexport const FORMAT_PROVIDER: InjectionToken<FormatProvider> = new InjectionToken<FormatProvider>('FORMAT_PROVIDER',\n {\n providedIn: 'root',\n factory: () =>\n {\n return {\n date: 'yyyy-MM-dd',\n dateTime: 'yyyy-MM-dd HH:mm',\n time: 'HH:mm',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n });"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAI7C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsC,IAAI,cAAc,CAAoB,sBAAsB,CAAC,CAAC;AAErI;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B,IAAI,cAAc,CAAU,UAAU,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC,IAAI,cAAc,CAAiB,iBAAiB,EACjB;IACI,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,GAAG,EAAE;QAEV,OAAO;YACH,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\n\nimport {DateApi, DateApiObjectCtor, FormatProvider} from '../services';\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject\n */\nexport const DATE_API_OBJECT_TYPE: InjectionToken<DateApiObjectCtor> = new InjectionToken<DateApiObjectCtor>('DATE_API_OBJECT_TYPE');\n\n/**\n * Injection token used for obtaining DateApi implementation\n */\nexport const DATE_API: InjectionToken<DateApi> = new InjectionToken<DateApi>('DATE_API');\n\n/**\n * Injection token used for obtaining FormatProvider implementation\n */\nexport const FORMAT_PROVIDER: InjectionToken<FormatProvider> = new InjectionToken<FormatProvider>('FORMAT_PROVIDER',\n {\n providedIn: 'root',\n factory: () =>\n {\n return {\n date: 'yyyy-MM-dd',\n dateTime: 'yyyy-MM-dd HH:mm',\n time: 'HH:mm',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n });"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateApi.interface.js","sourceRoot":"","sources":["../../../src/services/dateApi.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Date can be represented as formatted string, timestamp or javascript Date object\n */\nexport type DateValue = Date|string|number;\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport interface DateApiObject<TDate = any>\n{\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n readonly originalValue: TDate;\n\n /**\n * Instance of date\n */\n readonly value: TDate;\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n isValid(): boolean;\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n isWeekend(): boolean;\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n format(format: string): string;\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n startOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n endOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n startOfYear(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n endOfYear(): DateApiObject<TDate>;\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n addYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n subtractYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n startOfMonth(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n endOfMonth(): DateApiObject<TDate>;\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n addMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n subtractMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n startOfWeek(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n endOfWeek(): DateApiObject<TDate>;\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n addWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n subtractWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n startOfDay(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n endOfDay(): DateApiObject<TDate>;\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n addDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n subtractDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n startOfHour(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n endOfHour(): DateApiObject<TDate>;\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n addHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n subtractHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n startOfMinute(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n endOfMinute(): DateApiObject<TDate>;\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n addMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n subtractMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Gets number of days in month\n */\n daysInMonth(): number;\n\n /**\n * Gets year\n */\n year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n year(year: number): DateApiObject<TDate>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n year(year?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets month\n */\n month(): number;\n /**\n * Sets month\n * @param month - Month to be set\n */\n month(month: number): DateApiObject<TDate>;\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n month(month?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of month one based\n */\n dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n dayOfMonth(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n dayOfMonth(day?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of week zero based, first is monday\n */\n dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n dayOfWeek(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n dayOfWeek(day?: number): number|DateApiObject<TDate>;\n\n /**\n * Gets hours zero based\n */\n hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n hour(hour: number): DateApiObject<TDate>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n hour(hour?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets minutes zero based\n */\n minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n minute(minute: number): DateApiObject<TDate>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n minute(minute?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n isBefore(date: TDate): boolean;\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n isAfter(date: TDate): boolean;\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n diffDays(date: TDate): number;\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n isSameWeek(date: TDate): boolean;\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n isSameDecade(date: TDate): boolean;\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n isSameYear(date: TDate): boolean;\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n isSameMonth(date: TDate): boolean;\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n isSameDay(date: TDate): boolean;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n clone(): DateApiObject<TDate>;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n cloneOriginal(): DateApiObject<TDate>;\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n updateOriginal(value?: TDate): DateApiObject<TDate>;\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n resetOriginal(): DateApiObject<TDate>;\n}\n\n/**\n * Date api abstraction, used for obtaining DateApi wrapper object\n */\nexport interface DateApi<TDate = any>\n{\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n getValue(value: DateValue|TDate, format?: string): DateApiObject<TDate>;\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n now(): DateApiObject<TDate>;\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n getFormat(pseudoFormat: string): string;\n\n /**\n * Gets information\n */\n weekStartsOnMonday(): boolean;\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n weekdaysShort(): string[];\n\n /**\n * Tests whether is value TDate\n * @param value - Value to be tested whether is TDate\n */\n isDate(value: unknown): value is TDate;\n}"]}
|
|
1
|
+
{"version":3,"file":"dateApi.interface.js","sourceRoot":"","sources":["../../../src/services/dateApi.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Date can be represented as formatted string, timestamp or javascript Date object\n */\nexport type DateValue = Date|string|number;\n\n/**\n * Definition of type, that is used for creating instance of DateApiObject\n */\nexport interface DateApiObjectCtor<TObject extends DateApiObject<TDate> = any, TDate = any>\n{\n new (value: TDate|DateValue, format?: string, ...additionalParams: any[]): TObject;\n}\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport interface DateApiObject<TDate = any>\n{\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n readonly originalValue: TDate;\n\n /**\n * Instance of date\n */\n readonly value: TDate;\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n isValid(): boolean;\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n isWeekend(): boolean;\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n format(format: string): string;\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n startOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n endOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n startOfYear(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n endOfYear(): DateApiObject<TDate>;\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n addYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n subtractYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n startOfMonth(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n endOfMonth(): DateApiObject<TDate>;\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n addMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n subtractMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n startOfWeek(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n endOfWeek(): DateApiObject<TDate>;\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n addWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n subtractWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n startOfDay(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n endOfDay(): DateApiObject<TDate>;\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n addDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n subtractDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n startOfHour(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n endOfHour(): DateApiObject<TDate>;\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n addHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n subtractHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n startOfMinute(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n endOfMinute(): DateApiObject<TDate>;\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n addMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n subtractMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Gets number of days in month\n */\n daysInMonth(): number;\n\n /**\n * Gets year\n */\n year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n year(year: number): DateApiObject<TDate>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n year(year?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets month\n */\n month(): number;\n /**\n * Sets month\n * @param month - Month to be set\n */\n month(month: number): DateApiObject<TDate>;\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n month(month?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of month one based\n */\n dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n dayOfMonth(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n dayOfMonth(day?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of week zero based, first is monday\n */\n dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n dayOfWeek(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n dayOfWeek(day?: number): number|DateApiObject<TDate>;\n\n /**\n * Gets hours zero based\n */\n hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n hour(hour: number): DateApiObject<TDate>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n hour(hour?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets minutes zero based\n */\n minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n minute(minute: number): DateApiObject<TDate>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n minute(minute?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n isBefore(date: TDate): boolean;\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n isAfter(date: TDate): boolean;\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n diffDays(date: TDate): number;\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n isSameWeek(date: TDate): boolean;\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n isSameDecade(date: TDate): boolean;\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n isSameYear(date: TDate): boolean;\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n isSameMonth(date: TDate): boolean;\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n isSameDay(date: TDate): boolean;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n clone(): DateApiObject<TDate>;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n cloneOriginal(): DateApiObject<TDate>;\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n updateOriginal(value?: TDate): DateApiObject<TDate>;\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n resetOriginal(): DateApiObject<TDate>;\n}\n\n/**\n * Date api abstraction, used for obtaining DateApi wrapper object\n */\nexport interface DateApi<TDate = any>\n{\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n getValue(value: DateValue|TDate, format?: string): DateApiObject<TDate>;\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n now(): DateApiObject<TDate>;\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n getFormat(pseudoFormat: string): string;\n\n /**\n * Gets information\n */\n weekStartsOnMonday(): boolean;\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n weekdaysShort(): string[];\n\n /**\n * Tests whether is value TDate\n * @param value - Value to be tested whether is TDate\n */\n isDate(value: unknown): value is TDate;\n}"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { FORMAT_PROVIDER } from '@anglr/datetime';
|
|
2
|
+
import { DATE_API_OBJECT_TYPE, FORMAT_PROVIDER } from '@anglr/datetime';
|
|
3
|
+
import { dateFnsDateApiObjectType } from '../services/dateFnsDateApi.service';
|
|
3
4
|
/**
|
|
4
5
|
* Injection token used for obtaining Date fns locale service
|
|
5
6
|
*/
|
|
@@ -7,7 +8,7 @@ export const DATE_FNS_LOCALE = new InjectionToken('DATE_FNS_LOCALE');
|
|
|
7
8
|
/**
|
|
8
9
|
* Injection token used for obtaining date-fns FormatProvider implementation
|
|
9
10
|
*/
|
|
10
|
-
export const
|
|
11
|
+
export const DATE_FNS_FORMAT_PROVIDER = {
|
|
11
12
|
provide: FORMAT_PROVIDER,
|
|
12
13
|
useFactory: () => {
|
|
13
14
|
return {
|
|
@@ -28,4 +29,11 @@ export const DATEFNS_FORMAT_PROVIDER = {
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Injection token used for injecting type that creates instance of DateApiObject for date-fns
|
|
34
|
+
*/
|
|
35
|
+
export const DATE_FNS_DATE_API_OBJECT_TYPE = {
|
|
36
|
+
provide: DATE_API_OBJECT_TYPE,
|
|
37
|
+
useClass: dateFnsDateApiObjectType
|
|
38
|
+
};
|
|
31
39
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../date-fns/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../date-fns/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,oBAAoB,EAAkB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAGtF,OAAO,EAAC,wBAAwB,EAAC,MAAM,oCAAoC,CAAC;AAE5E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkC,IAAI,cAAc,CAAgB,iBAAiB,CAAC,CAAC;AAEnH;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACrC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAC1C;IACI,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,wBAAwB;CACrC,CAAC","sourcesContent":["import {ClassProvider, FactoryProvider, InjectionToken} from '@angular/core';\nimport {DATE_API_OBJECT_TYPE, FormatProvider, FORMAT_PROVIDER} from '@anglr/datetime';\n\nimport {DateFnsLocale} from '../services/dateFnsLocale.service';\nimport {dateFnsDateApiObjectType} from '../services/dateFnsDateApi.service';\n\n/**\n * Injection token used for obtaining Date fns locale service\n */\nexport const DATE_FNS_LOCALE: InjectionToken<DateFnsLocale> = new InjectionToken<DateFnsLocale>('DATE_FNS_LOCALE');\n\n/**\n * Injection token used for obtaining date-fns FormatProvider implementation\n */\nexport const DATE_FNS_FORMAT_PROVIDER: FactoryProvider =\n{\n provide: FORMAT_PROVIDER,\n useFactory: () =>\n {\n return <FormatProvider>{\n date: 'P',\n dateTime: 'Pp',\n time: 'p',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n};\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject for date-fns\n */\nexport const DATE_FNS_DATE_API_OBJECT_TYPE: ClassProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useClass: dateFnsDateApiObjectType\n};"]}
|