UNPKG

node-red-contrib-home-assistant-websocket

Version:
31 lines (30 loc) 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getStatusOptions = getStatusOptions; function getStatusOptions(config) { var _a, _b, _c; const options = { year: (config === null || config === void 0 ? void 0 : config.statusYear) === 'hidden' ? undefined : config === null || config === void 0 ? void 0 : config.statusYear, month: (config === null || config === void 0 ? void 0 : config.statusMonth) === 'hidden' ? undefined : ((_a = config === null || config === void 0 ? void 0 : config.statusMonth) !== null && _a !== void 0 ? _a : 'short'), day: (config === null || config === void 0 ? void 0 : config.statusDay) === 'hidden' ? undefined : ((_b = config === null || config === void 0 ? void 0 : config.statusDay) !== null && _b !== void 0 ? _b : 'numeric'), hourCycle: (config === null || config === void 0 ? void 0 : config.statusHourCycle) === 'default' ? undefined : ((_c = config === null || config === void 0 ? void 0 : config.statusHourCycle) !== null && _c !== void 0 ? _c : 'h23'), hour: 'numeric', minute: 'numeric', }; switch (config === null || config === void 0 ? void 0 : config.statusTimeFormat) { case 'h:m:s': options.second = 'numeric'; break; case 'h:m:s.ms': options.second = 'numeric'; options.fractionalSecondDigits = 3; break; } return options; }