@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
37 lines (33 loc) • 996 B
JavaScript
/**
* @package @bitrix24/b24jssdk
* @version 2.0.0
* @copyright (c) 2026 Bitrix24
* @license MIT
* @see https://github.com/bitrix24/b24jssdk
* @see https://bitrix24.github.io/b24jssdk/
*/
;
const luxon = require('luxon');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
class AbstractFormatter {
static {
__name(this, "AbstractFormatter");
}
dateFormat;
constructor(dateFormat = "YYYY-MM-DD HH:mm:ss") {
this.dateFormat = dateFormat;
}
_formatTimestamp(date) {
const dt = luxon.DateTime.fromJSDate(date);
return Math.floor(dt.toSeconds()).toFixed(0);
}
_formatDate(date) {
const dt = luxon.DateTime.fromJSDate(date);
return dt.toFormat(
this.dateFormat.replace(/YYYY/g, "yyyy").replace(/YY/g, "yy").replace(/DD/g, "dd").replace(/D/g, "d")
);
}
}
exports.AbstractFormatter = AbstractFormatter;
//# sourceMappingURL=abstract-formatter.cjs.map