@objectstack/core 9.7.0 → 9.9.0

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.cjs CHANGED
@@ -54,6 +54,8 @@ __export(index_exports, {
54
54
  SemanticVersionManager: () => SemanticVersionManager,
55
55
  ServiceLifecycle: () => ServiceLifecycle,
56
56
  buildPermissionsFromGrants: () => buildPermissionsFromGrants,
57
+ calendarPartsInTz: () => calendarPartsInTz,
58
+ calendarPartsInTzOrUtc: () => calendarPartsInTzOrUtc,
57
59
  counterSignPayload: () => counterSignPayload,
58
60
  createApiRegistryPlugin: () => createApiRegistryPlugin,
59
61
  createLogger: () => createLogger,
@@ -4056,6 +4058,31 @@ function safeJsonParse(s, fallback) {
4056
4058
  }
4057
4059
  }
4058
4060
 
4061
+ // src/utils/datetime.ts
4062
+ function calendarPartsInTz(d, tz) {
4063
+ const parts = new Intl.DateTimeFormat("en-US", {
4064
+ timeZone: tz,
4065
+ year: "numeric",
4066
+ month: "2-digit",
4067
+ day: "2-digit"
4068
+ }).formatToParts(d);
4069
+ const get = (t) => Number(parts.find((p) => p.type === t)?.value);
4070
+ return { year: get("year"), month: get("month"), day: get("day") };
4071
+ }
4072
+ function calendarPartsInTzOrUtc(d, tz) {
4073
+ if (tz && tz !== "UTC") {
4074
+ try {
4075
+ return calendarPartsInTz(d, tz);
4076
+ } catch {
4077
+ }
4078
+ }
4079
+ return {
4080
+ year: d.getUTCFullYear(),
4081
+ month: d.getUTCMonth() + 1,
4082
+ day: d.getUTCDate()
4083
+ };
4084
+ }
4085
+
4059
4086
  // src/health-monitor.ts
4060
4087
  var PluginHealthMonitor = class {
4061
4088
  constructor(logger) {
@@ -4995,6 +5022,8 @@ var NamespaceResolver = class {
4995
5022
  SemanticVersionManager,
4996
5023
  ServiceLifecycle,
4997
5024
  buildPermissionsFromGrants,
5025
+ calendarPartsInTz,
5026
+ calendarPartsInTzOrUtc,
4998
5027
  counterSignPayload,
4999
5028
  createApiRegistryPlugin,
5000
5029
  createLogger,