@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
35 lines (32 loc) • 954 B
JavaScript
/**
* @package @bitrix24/b24jssdk
* @version 1.1.0
* @copyright (c) 2026 Bitrix24
* @license MIT
* @see https://github.com/bitrix24/b24jssdk
* @see https://bitrix24.github.io/b24jssdk/
*/
import { DateTime } from '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 = DateTime.fromJSDate(date);
return Math.floor(dt.toSeconds()).toFixed(0);
}
_formatDate(date) {
const dt = DateTime.fromJSDate(date);
return dt.toFormat(
this.dateFormat.replace(/YYYY/g, "yyyy").replace(/YY/g, "yy").replace(/DD/g, "dd").replace(/D/g, "d")
);
}
}
export { AbstractFormatter };
//# sourceMappingURL=abstract-formatter.mjs.map