igniteui-react-grids
Version:
Ignite UI React grid components.
99 lines (98 loc) • 4.14 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 DateTimeColumnValueFormatter = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(DateTimeColumnValueFormatter, _super);
function DateTimeColumnValueFormatter() {
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;
}
DateTimeColumnValueFormatter.prototype.k = function () {
this.b = true;
};
DateTimeColumnValueFormatter.prototype.j = function (a) {
this.a = a;
this.b = false;
};
DateTimeColumnValueFormatter.prototype.i = function (a) {
if (+a == +(dateMinValue())) {
return "";
}
var b = (Intl && Intl.DateTimeFormat);
if (b) {
var format_ = null;
switch (this.a) {
case 4:
if (this.f == null) {
this.f = (new Intl.DateTimeFormat([], { month: 'numeric', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }));
}
format_ = this.f;
break;
case 5:
if (this.e == null) {
this.e = (new Intl.DateTimeFormat([], { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }));
}
format_ = this.e;
break;
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;
case 3:
if (this.g == null) {
this.g = (new Intl.DateTimeFormat([], { hour: 'numeric', minute: 'numeric', second: 'numeric' }));
}
format_ = this.g;
break;
case 2:
if (this.h == null) {
this.h = (new Intl.DateTimeFormat([], { hour: 'numeric', minute: 'numeric' }));
}
format_ = this.h;
break;
}
var date_ = a;
return (format_.format(date_));
}
else {
var date_ = a;
switch (this.a) {
case 4: return (date_.toLocaleString());
case 5: return (date_.toLocaleString());
case 1: return (date_.toLocaleDateString());
case 0: return (date_.toLocaleDateString());
case 3: return (date_.toLocaleTimeString());
case 2: return (date_.toLocaleTimeString());
}
return a.toString();
}
};
DateTimeColumnValueFormatter.$t = markType(DateTimeColumnValueFormatter, 'DateTimeColumnValueFormatter');
return DateTimeColumnValueFormatter;
}(Base));
export { DateTimeColumnValueFormatter };