UNPKG

@bxshefby/b24jssdk

Version:

Bitrix24 REST API JavaScript SDK

33 lines (30 loc) • 886 B
/** * @package @bxshefby/b24jssdk * @version 3.3.0 * @copyright (c) 2026 Bitrix24 * @license MIT * @see https://github.com/bx-shef/b24-js-sdk * @see https://b24-js-sdk.bx-shef.by/ */ import { formatDate } from './date-format.mjs'; 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) { return Math.floor((date instanceof Date ? date.getTime() : Number.NaN) / 1e3).toFixed(0); } _formatDate(date) { return formatDate( date, this.dateFormat.replace(/YYYY/g, "yyyy").replace(/YY/g, "yy").replace(/DD/g, "dd").replace(/D/g, "d") ); } } export { AbstractFormatter };