UNPKG

dtable-utils

Version:

dtable common utils

29 lines (25 loc) 963 B
import { getColumnType } from './core.js'; import { DATE_COLUMN_OPTIONS, DATE_FORMAT_MAP } from '../constants/column.js'; /** * Check whether is date column: * - column type is date, ctime or mtime etc. * - column type is formula and result_type is date * - column type is link/link_fromula and array_type is date, ctime or mtime etc. * @param {object} column e.g. { type, data } * @returns true/false, bool */ var isDateColumn = function isDateColumn(column) { return DATE_COLUMN_OPTIONS.includes(getColumnType(column)); }; /** * Check whether the format is supported in date column * @param {string} format * @returns bool */ var isSupportDateColumnFormat = function isSupportDateColumnFormat(format) { if (!format) { return false; } return format === DATE_FORMAT_MAP.YYYY_MM_DD || format === DATE_FORMAT_MAP.YYYY_MM_DD_HH_MM || format === DATE_FORMAT_MAP.YYYY_MM_DD_HH_MM_SS; }; export { isDateColumn, isSupportDateColumnFormat };