igniteui-react-core
Version:
Ignite UI React Core.
242 lines (241 loc) • 7.39 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { FormatSpecifier } from "./FormatSpecifier";
import { markType } from "./type";
import { stringIsNullOrEmpty } from "./string";
/**
* @hidden
*/
export let DateTimeFormatSpecifier = /*@__PURE__*/ (() => {
class DateTimeFormatSpecifier extends FormatSpecifier {
constructor() {
super();
this._locale = null;
this._dateStyle = null;
this._timeStyle = null;
this._fractionalSecondDigits = 0;
this._calendar = null;
this._dayPeriod = null;
this._numberingSystem = null;
this._localeMatcher = null;
this._timeZone = null;
this._hour12 = null;
this._hourCycle = null;
this._formatMatcher = null;
this._weekDay = null;
this._era = null;
this._year = null;
this._month = null;
this._day = null;
this._hour = null;
this._minute = null;
this._second = null;
this._timeZoneName = null;
this.fractionalSecondDigits = -1;
}
toIntl() {
let a = {};
if (this.dateStyle != null) {
this.aa(a, "dateStyle", this.dateStyle);
}
if (this.timeStyle != null) {
this.aa(a, "timeStyle", this.timeStyle);
}
if (this.fractionalSecondDigits != -1) {
this.aa(a, "fractionalSecondDigits", this.fractionalSecondDigits);
}
if (this.calendar != null) {
this.aa(a, "calendar", this.calendar);
}
if (this.dayPeriod != null) {
this.aa(a, "dayPeriod", this.dayPeriod);
}
if (this.numberingSystem != null) {
this.aa(a, "numberingSystem", this.numberingSystem);
}
if (this.localeMatcher != null) {
this.aa(a, "localeMatcher", this.localeMatcher);
}
if (this.timeZone != null) {
this.aa(a, "timeZone", this.timeZone);
}
if (this.hour12 != null) {
this.aa(a, "hour12", this.hour12.toLowerCase() == "true" ? true : false);
}
if (this.hourCycle != null) {
this.aa(a, "hourCycle", this.hourCycle);
}
if (this.formatMatcher != null) {
this.aa(a, "formatMatcher", this.formatMatcher);
}
if (this.weekDay != null) {
this.aa(a, "weekday", this.weekDay);
}
if (this.era != null) {
this.aa(a, "era", this.era);
}
if (this.year != null) {
this.aa(a, "year", this.year);
}
if (this.month != null) {
this.aa(a, "month", this.month);
}
if (this.day != null) {
this.aa(a, "day", this.day);
}
if (this.hour != null) {
this.aa(a, "hour", this.hour);
}
if (this.minute != null) {
this.aa(a, "minute", this.minute);
}
if (this.second != null) {
this.aa(a, "second", this.second);
}
if (this.timeZoneName != null) {
this.aa(a, "timeZoneName", this.timeZoneName);
}
let locale_ = stringIsNullOrEmpty(this.locale) ? this.getLocalCulture() : this.locale;
let options_ = a;
return new Intl.DateTimeFormat(locale_, options_);
}
aa(options_, propertyName_, value_) {
options_[propertyName_] = value_;
}
c() {
return this.toIntl();
}
get locale() {
return this._locale;
}
set locale(a) {
this._locale = a;
}
get dateStyle() {
return this._dateStyle;
}
set dateStyle(a) {
this._dateStyle = a;
}
get timeStyle() {
return this._timeStyle;
}
set timeStyle(a) {
this._timeStyle = a;
}
get fractionalSecondDigits() {
return this._fractionalSecondDigits;
}
set fractionalSecondDigits(a) {
this._fractionalSecondDigits = a;
}
get calendar() {
return this._calendar;
}
set calendar(a) {
this._calendar = a;
}
get dayPeriod() {
return this._dayPeriod;
}
set dayPeriod(a) {
this._dayPeriod = a;
}
get numberingSystem() {
return this._numberingSystem;
}
set numberingSystem(a) {
this._numberingSystem = a;
}
get localeMatcher() {
return this._localeMatcher;
}
set localeMatcher(a) {
this._localeMatcher = a;
}
get timeZone() {
return this._timeZone;
}
set timeZone(a) {
this._timeZone = a;
}
get hour12() {
return this._hour12;
}
set hour12(a) {
this._hour12 = a;
}
get hourCycle() {
return this._hourCycle;
}
set hourCycle(a) {
this._hourCycle = a;
}
get formatMatcher() {
return this._formatMatcher;
}
set formatMatcher(a) {
this._formatMatcher = a;
}
get weekDay() {
return this._weekDay;
}
set weekDay(a) {
this._weekDay = a;
}
get era() {
return this._era;
}
set era(a) {
this._era = a;
}
get year() {
return this._year;
}
set year(a) {
this._year = a;
}
get month() {
return this._month;
}
set month(a) {
this._month = a;
}
get day() {
return this._day;
}
set day(a) {
this._day = a;
}
get hour() {
return this._hour;
}
set hour(a) {
this._hour = a;
}
get minute() {
return this._minute;
}
set minute(a) {
this._minute = a;
}
get second() {
return this._second;
}
set second(a) {
this._second = a;
}
get timeZoneName() {
return this._timeZoneName;
}
set timeZoneName(a) {
this._timeZoneName = a;
}
}
DateTimeFormatSpecifier.$t = /*@__PURE__*/ markType(DateTimeFormatSpecifier, 'DateTimeFormatSpecifier', FormatSpecifier.$);
return DateTimeFormatSpecifier;
})();