igniteui-react-inputs
Version:
Ignite UI React input components.
111 lines (110 loc) • 4.06 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 { Base, markType } from "igniteui-react-core";
import { dateMinValue } from "igniteui-react-core";
/**
* @hidden
*/
var DateTimeValueFormatter = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(DateTimeValueFormatter, _super);
function DateTimeValueFormatter() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.a = 0;
_this.b = false;
_this.f = null;
_this.e = null;
_this.c = null;
_this.d = null;
_this.g = null;
_this.h = null;
return _this;
}
DateTimeValueFormatter.prototype.l = function () {
this.b = true;
};
DateTimeValueFormatter.prototype.k = function (a) {
this.a = a;
this.b = false;
};
DateTimeValueFormatter.prototype.i = function (a) {
if (+a == +(dateMinValue())) {
return "";
}
var b = (Intl && Intl.DateTimeFormat);
if (b) {
var format_ = null;
switch (this.a) {
case 1:
if (this.c == null) {
this.c = (new Intl.DateTimeFormat([], { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' }));
}
format_ = this.c;
break;
case 0:
if (this.d == null) {
this.d = (new Intl.DateTimeFormat([], { month: 'numeric', day: 'numeric', year: 'numeric' }));
}
format_ = this.d;
break;
}
var date_ = a;
return (format_.format(date_));
}
else {
var date_ = a;
switch (this.a) {
case 1: return (date_.toLocaleDateString());
case 0: return (date_.toLocaleDateString());
}
return a.toString();
}
};
DateTimeValueFormatter.prototype.j = function () {
var a = (Intl && Intl.DateTimeFormat);
if (a) {
var format_ = null;
switch (this.a) {
case 1:
if (this.c == null) {
this.c = (new Intl.DateTimeFormat([], { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' }));
}
format_ = this.c;
break;
case 0:
if (this.d == null) {
this.d = (new Intl.DateTimeFormat([], { month: 'numeric', day: 'numeric', year: 'numeric' }));
}
format_ = this.d;
break;
}
var b = (format_.formatToParts(new Date()));
var c = "";
for (var d = 0; d < b.length; d++) {
switch ((b[d].type)) {
case "day":
c += "d";
break;
case "month":
c += "m";
break;
case "year":
c += "yyyy";
break;
default:
c += (b[d].value);
break;
}
}
return c;
}
return "m/d/yyyy";
};
DateTimeValueFormatter.$t = markType(DateTimeValueFormatter, 'DateTimeValueFormatter');
return DateTimeValueFormatter;
}(Base));
export { DateTimeValueFormatter };