@marcoschwartz/lite-ui 0.26.2 → 0.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6354,47 +6354,38 @@ function formatPercent(value, options = {}) {
6354
6354
  const percent = multiply ? value * 100 : value;
6355
6355
  return `${percent.toFixed(precision)}%`;
6356
6356
  }
6357
+ var MONTHS4 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
6358
+ function formatTimeUTC(date, showSeconds = false) {
6359
+ const hours = date.getUTCHours();
6360
+ const minutes = date.getUTCMinutes().toString().padStart(2, "0");
6361
+ const seconds = date.getUTCSeconds().toString().padStart(2, "0");
6362
+ const ampm = hours >= 12 ? "PM" : "AM";
6363
+ const hour12 = hours % 12 || 12;
6364
+ const hourStr = hour12.toString().padStart(2, "0");
6365
+ return showSeconds ? `${hourStr}:${minutes}:${seconds} ${ampm}` : `${hourStr}:${minutes} ${ampm}`;
6366
+ }
6357
6367
  function formatDate(date, rangeMs) {
6358
6368
  const minute = 60 * 1e3;
6359
6369
  const hour = 60 * minute;
6360
6370
  const day = 24 * hour;
6361
6371
  const month = 30 * day;
6362
6372
  const year = 365 * day;
6373
+ const monthName = MONTHS4[date.getUTCMonth()];
6374
+ const dayNum = date.getUTCDate();
6375
+ const yearNum = date.getUTCFullYear();
6363
6376
  if (!rangeMs) {
6364
- return date.toLocaleDateString("en-US", {
6365
- month: "short",
6366
- day: "numeric",
6367
- year: "numeric"
6368
- });
6377
+ return `${monthName} ${dayNum}, ${yearNum}`;
6369
6378
  }
6370
6379
  if (rangeMs < hour) {
6371
- return date.toLocaleTimeString("en-US", {
6372
- hour: "2-digit",
6373
- minute: "2-digit",
6374
- second: "2-digit"
6375
- });
6380
+ return formatTimeUTC(date, true);
6376
6381
  } else if (rangeMs < day) {
6377
- return date.toLocaleTimeString("en-US", {
6378
- hour: "2-digit",
6379
- minute: "2-digit"
6380
- });
6382
+ return formatTimeUTC(date, false);
6381
6383
  } else if (rangeMs < month) {
6382
- return date.toLocaleDateString("en-US", {
6383
- month: "short",
6384
- day: "numeric",
6385
- hour: "2-digit",
6386
- minute: "2-digit"
6387
- });
6384
+ return `${monthName} ${dayNum}, ${formatTimeUTC(date, false)}`;
6388
6385
  } else if (rangeMs < year) {
6389
- return date.toLocaleDateString("en-US", {
6390
- month: "short",
6391
- day: "numeric"
6392
- });
6386
+ return `${monthName} ${dayNum}`;
6393
6387
  } else {
6394
- return date.toLocaleDateString("en-US", {
6395
- month: "short",
6396
- year: "numeric"
6397
- });
6388
+ return `${monthName} ${yearNum}`;
6398
6389
  }
6399
6390
  }
6400
6391
  function createTickFormatter(domain) {