@marktiderman/genesis-ui-native 2.8.0 → 2.8.1

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.
@@ -475,7 +475,11 @@ declare function dayToDate(value: unknown): Date | null;
475
475
  /** A picked Date back to the `YYYY-MM-DD` day it shows, from its local parts (never `toISOString`). */
476
476
  declare function dateToDay(date: Date): string;
477
477
  /** A calendar day, the same day on every clock. */
478
- declare function formatDay(value: unknown): string;
478
+ /**
479
+ * A day. A calendar day (`YYYY-MM-DD`) from its parts; a timestamp as the day it is on `zone`'s
480
+ * clock (core's `wallClock`), so an 8pm edit in New York isn't tomorrow's (its UTC day).
481
+ */
482
+ declare function formatDay(value: unknown, zone?: string): string;
479
483
  /** A column's clock: "viewer" (the default) and "practice" from `zones`, else a valid IANA name. */
480
484
  declare function resolveZone(zone: string | undefined, zones: DisplayTimeZones): string;
481
485
  /** A timestamp as the clock on the wall in `zone` shows it (core's `wallClock`), not the device's. */
@@ -870,9 +870,14 @@ function dateToDay(date) {
870
870
  const pad = (n) => String(n).padStart(2, "0");
871
871
  return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
872
872
  }
873
- function formatDay(value) {
873
+ function formatDay(value, zone = personTimeZone()) {
874
874
  const date = dayToDate(value);
875
- return date ? DAY.format(date) : String(value);
875
+ if (date) return DAY.format(date);
876
+ const text2 = String(value);
877
+ const at = /^\d{4}-\d{2}-\d{2}[T ]/.test(text2) ? new Date(text2) : null;
878
+ if (!at || Number.isNaN(at.getTime()) || !isTimeZone(zone)) return text2;
879
+ const wall = wallClock(zone, at);
880
+ return DAY.format(new Date(wall.year, wall.month - 1, wall.day));
876
881
  }
877
882
  function resolveZone(zone, zones) {
878
883
  if (!zone || zone === "viewer") return zones.viewer;
@@ -905,7 +910,7 @@ function displayText(hint, value, messages, timeZone = personTimeZone()) {
905
910
  case "badge":
906
911
  return titleCase(String(value));
907
912
  case "date":
908
- return formatDay(value);
913
+ return formatDay(value, timeZone);
909
914
  case "datetime":
910
915
  return formatInstant(value, timeZone);
911
916
  case "url": {