igniteui-react-core
Version:
Ignite UI React Core.
328 lines (327 loc) • 10.3 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 { __extends } from "tslib";
import { FormatSpecifier } from "./FormatSpecifier";
import { markType } from "./type";
import { stringIsNullOrEmpty } from "./string";
/**
* @hidden
*/
var DateTimeFormatSpecifier = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(DateTimeFormatSpecifier, _super);
function DateTimeFormatSpecifier() {
var _this = _super.call(this) || this;
_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;
return _this;
}
DateTimeFormatSpecifier.prototype.toIntl = function () {
var 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);
}
var locale_ = stringIsNullOrEmpty(this.locale) ? this.getLocalCulture() : this.locale;
var options_ = a;
return new Intl.DateTimeFormat(locale_, options_);
};
DateTimeFormatSpecifier.prototype.aa = function (options_, propertyName_, value_) {
options_[propertyName_] = value_;
};
DateTimeFormatSpecifier.prototype.c = function () {
return this.toIntl();
};
Object.defineProperty(DateTimeFormatSpecifier.prototype, "locale", {
get: function () {
return this._locale;
},
set: function (a) {
this._locale = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "dateStyle", {
get: function () {
return this._dateStyle;
},
set: function (a) {
this._dateStyle = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "timeStyle", {
get: function () {
return this._timeStyle;
},
set: function (a) {
this._timeStyle = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "fractionalSecondDigits", {
get: function () {
return this._fractionalSecondDigits;
},
set: function (a) {
this._fractionalSecondDigits = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "calendar", {
get: function () {
return this._calendar;
},
set: function (a) {
this._calendar = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "dayPeriod", {
get: function () {
return this._dayPeriod;
},
set: function (a) {
this._dayPeriod = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "numberingSystem", {
get: function () {
return this._numberingSystem;
},
set: function (a) {
this._numberingSystem = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "localeMatcher", {
get: function () {
return this._localeMatcher;
},
set: function (a) {
this._localeMatcher = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "timeZone", {
get: function () {
return this._timeZone;
},
set: function (a) {
this._timeZone = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "hour12", {
get: function () {
return this._hour12;
},
set: function (a) {
this._hour12 = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "hourCycle", {
get: function () {
return this._hourCycle;
},
set: function (a) {
this._hourCycle = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "formatMatcher", {
get: function () {
return this._formatMatcher;
},
set: function (a) {
this._formatMatcher = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "weekDay", {
get: function () {
return this._weekDay;
},
set: function (a) {
this._weekDay = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "era", {
get: function () {
return this._era;
},
set: function (a) {
this._era = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "year", {
get: function () {
return this._year;
},
set: function (a) {
this._year = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "month", {
get: function () {
return this._month;
},
set: function (a) {
this._month = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "day", {
get: function () {
return this._day;
},
set: function (a) {
this._day = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "hour", {
get: function () {
return this._hour;
},
set: function (a) {
this._hour = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "minute", {
get: function () {
return this._minute;
},
set: function (a) {
this._minute = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "second", {
get: function () {
return this._second;
},
set: function (a) {
this._second = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DateTimeFormatSpecifier.prototype, "timeZoneName", {
get: function () {
return this._timeZoneName;
},
set: function (a) {
this._timeZoneName = a;
},
enumerable: false,
configurable: true
});
DateTimeFormatSpecifier.$t = markType(DateTimeFormatSpecifier, 'DateTimeFormatSpecifier', FormatSpecifier.$);
return DateTimeFormatSpecifier;
}(FormatSpecifier));
export { DateTimeFormatSpecifier };