igniteui-react-grids
Version:
Ignite UI React grid components.
97 lines (96 loc) • 4.12 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 { Base, markType } from "igniteui-react-core";
import { dateMinValue } from "igniteui-react-core";
/**
* @hidden
*/
export let DateTimeColumnValueFormatter = /*@__PURE__*/ (() => {
class DateTimeColumnValueFormatter extends Base {
constructor() {
super(...arguments);
this.a = 0;
this.b = false;
this.f = null;
this.e = null;
this.c = null;
this.d = null;
this.g = null;
this.h = null;
}
k() {
this.b = true;
}
j(a) {
this.a = a;
this.b = false;
}
i(a) {
if (+a == +(dateMinValue())) {
return "";
}
let b = (Intl && Intl.DateTimeFormat);
if (b) {
let 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;
}
let date_ = a;
return (format_.format(date_));
}
else {
let 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 = /*@__PURE__*/ markType(DateTimeColumnValueFormatter, 'DateTimeColumnValueFormatter');
return DateTimeColumnValueFormatter;
})();