UNPKG

handsontable

Version:

Handsontable is a JavaScript Data Grid available for React, Angular and Vue.

26 lines (25 loc) 893 B
import * as C from "../../../../i18n/constants.mjs"; import { registerCondition } from "../../conditionRegisterer.mjs"; import { parseToLocalTime } from "../../../../helpers/dateTime.mjs"; export const CONDITION_NAME = 'intl_time_before'; /** * @param {object} dataRow The object which holds and describes the single cell value. * @param {Array} inputValues An array of values to compare with. * @param {*} inputValues."0" Maximum time of a range. * @returns {boolean} */ export function condition(dataRow, _ref) { let [value] = _ref; const dataTime = parseToLocalTime(dataRow.value); const inputTime = parseToLocalTime(value); if (dataTime === null || inputTime === null) { return false; } return dataTime <= inputTime; } registerCondition(CONDITION_NAME, condition, { name: C.FILTERS_CONDITIONS_BEFORE, inputsCount: 1, showOperators: true, inputType: 'time' });