const transformValue = (value, type) => { if (value && (type === 'time' || value instanceof Date)) { // TODO support for max time return (value instanceof Date ? moment(value) : moment.utc(value)).format(moment.HTML5_FMT.DATETIME_LOCAL_MS); } return value && value.value ? value.value : value; // TODO move to sql adapter }
formatFromDate(date) { if (date && date.match(dateTimeLocalMsRegex)) { return date; } if (date && date.match(dateRegex)) { return `${date}T00:00:00.000`; } if (!date) { return moment.tz(date, this.query.timezone).format('YYYY-MM-DD 00:00:00'); } return moment.tz(date, this.query.timezone).format(moment.HTML5_FMT.DATETIME_LOCAL_MS); }
inDbTimeZone(date) { return this.inIntegrationTimeZone(date).clone().utc().format(moment.HTML5_FMT.DATETIME_LOCAL_MS); }
const timestampTypeParser = val => moment.utc(val).format(moment.HTML5_FMT.DATETIME_LOCAL_MS)
(d, i) => ( i === 0 ? moment.utc(d).format(d.match(DateRegex) ? 'YYYY-MM-DDT00:00:00.000' : moment.HTML5_FMT.DATETIME_LOCAL_MS) : moment.utc(d).format(d.match(DateRegex) ? 'YYYY-MM-DDT23:59:59.999' : moment.HTML5_FMT.DATETIME_LOCAL_MS)
formatToDate(date) { if (date && date.match(dateTimeLocalMsRegex)) { return date; } if (date && date.match(dateRegex)) { return `${date}T23:59:59.999`; } if (!date) { return moment.tz(date, this.query.timezone).format('YYYY-MM-DDT23:59:59.999'); } return moment.tz(date, this.query.timezone).format(moment.HTML5_FMT.DATETIME_LOCAL_MS); }