UNPKG

node-red-contrib-home-assistant-websocket

Version:
16 lines (15 loc) 708 B
"use strict"; var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatDate = formatDate; const fallbackLocale = 'en-US'; const defaultLocale = (_b = (_a = Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat()) === null || _a === void 0 ? void 0 : _a.resolvedOptions()) === null || _b === void 0 ? void 0 : _b.locale; const defaultOptions = { month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', }; function formatDate({ date = new Date(), locale = defaultLocale !== null && defaultLocale !== void 0 ? defaultLocale : fallbackLocale, options = defaultOptions, }) { return new Intl.DateTimeFormat(locale, options).format(date); }