@oneuptime/cli 14.0.91 → 14.0.92

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.
Files changed (2) hide show
  1. package/build/dist/Index.js +873 -201
  2. package/package.json +1 -1
@@ -12155,18 +12155,18 @@ var require_moment_timezone = __commonJS({
12155
12155
  } else {
12156
12156
  factory2(root.moment);
12157
12157
  }
12158
- })(exports2, function(moment2) {
12158
+ })(exports2, function(moment3) {
12159
12159
  "use strict";
12160
- if (moment2.version === void 0 && moment2.default) {
12161
- moment2 = moment2.default;
12160
+ if (moment3.version === void 0 && moment3.default) {
12161
+ moment3 = moment3.default;
12162
12162
  }
12163
12163
  var VERSION3 = "0.5.46", zones = {}, links = {}, countries = {}, names = {}, guesses = {}, cachedGuess;
12164
- if (!moment2 || typeof moment2.version !== "string") {
12164
+ if (!moment3 || typeof moment3.version !== "string") {
12165
12165
  logError("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
12166
12166
  }
12167
- var momentVersion = moment2.version.split("."), major = +momentVersion[0], minor = +momentVersion[1];
12167
+ var momentVersion = moment3.version.split("."), major = +momentVersion[0], minor = +momentVersion[1];
12168
12168
  if (major < 2 || major === 2 && minor < 6) {
12169
- logError("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + moment2.version + ". See momentjs.com");
12169
+ logError("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + moment3.version + ". See momentjs.com");
12170
12170
  }
12171
12171
  function charCodeToInt(charCode) {
12172
12172
  if (charCode > 96) {
@@ -12586,8 +12586,8 @@ var require_moment_timezone = __commonJS({
12586
12586
  }
12587
12587
  __name(logError, "logError");
12588
12588
  function tz(input) {
12589
- var args = Array.prototype.slice.call(arguments, 0, -1), name = arguments[arguments.length - 1], out = moment2.utc.apply(null, args), zone;
12590
- if (!moment2.isMoment(input) && needsOffset(out) && (zone = getZone(name))) {
12589
+ var args = Array.prototype.slice.call(arguments, 0, -1), name = arguments[arguments.length - 1], out = moment3.utc.apply(null, args), zone;
12590
+ if (!moment3.isMoment(input) && needsOffset(out) && (zone = getZone(name))) {
12591
12591
  out.add(zone.parse(out), "minutes");
12592
12592
  }
12593
12593
  out.tz(name);
@@ -12615,14 +12615,14 @@ var require_moment_timezone = __commonJS({
12615
12615
  tz.moveAmbiguousForward = false;
12616
12616
  tz.countries = getCountryNames;
12617
12617
  tz.zonesForCountry = zonesForCountry;
12618
- var fn = moment2.fn;
12619
- moment2.tz = tz;
12620
- moment2.defaultZone = null;
12621
- moment2.updateOffset = function(mom, keepTime) {
12622
- var zone = moment2.defaultZone, offset;
12618
+ var fn = moment3.fn;
12619
+ moment3.tz = tz;
12620
+ moment3.defaultZone = null;
12621
+ moment3.updateOffset = function(mom, keepTime) {
12622
+ var zone = moment3.defaultZone, offset;
12623
12623
  if (mom._z === void 0) {
12624
12624
  if (zone && needsOffset(mom) && !mom._isUTC && mom.isValid()) {
12625
- mom._d = moment2.utc(mom._a)._d;
12625
+ mom._d = moment3.utc(mom._a)._d;
12626
12626
  mom.utc().add(zone.parse(mom), "minutes");
12627
12627
  }
12628
12628
  mom._z = zone;
@@ -12648,7 +12648,7 @@ var require_moment_timezone = __commonJS({
12648
12648
  }
12649
12649
  this._z = getZone(name);
12650
12650
  if (this._z) {
12651
- moment2.updateOffset(this, keepTime);
12651
+ moment3.updateOffset(this, keepTime);
12652
12652
  } else {
12653
12653
  logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/.");
12654
12654
  }
@@ -12686,21 +12686,21 @@ var require_moment_timezone = __commonJS({
12686
12686
  fn.utc = resetZoneWrap(fn.utc);
12687
12687
  fn.local = resetZoneWrap(fn.local);
12688
12688
  fn.utcOffset = resetZoneWrap2(fn.utcOffset);
12689
- moment2.tz.setDefault = function(name) {
12689
+ moment3.tz.setDefault = function(name) {
12690
12690
  if (major < 2 || major === 2 && minor < 9) {
12691
- logError("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + moment2.version + ".");
12691
+ logError("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + moment3.version + ".");
12692
12692
  }
12693
- moment2.defaultZone = name ? getZone(name) : null;
12694
- return moment2;
12693
+ moment3.defaultZone = name ? getZone(name) : null;
12694
+ return moment3;
12695
12695
  };
12696
- var momentProperties = moment2.momentProperties;
12696
+ var momentProperties = moment3.momentProperties;
12697
12697
  if (Object.prototype.toString.call(momentProperties) === "[object Array]") {
12698
12698
  momentProperties.push("_z");
12699
12699
  momentProperties.push("_a");
12700
12700
  } else if (momentProperties) {
12701
12701
  momentProperties._z = null;
12702
12702
  }
12703
- return moment2;
12703
+ return moment3;
12704
12704
  });
12705
12705
  }
12706
12706
  });
@@ -13567,8 +13567,8 @@ var require_latest = __commonJS({
13567
13567
  var require_moment_timezone2 = __commonJS({
13568
13568
  "../Common/node_modules/moment-timezone/index.js"(exports2, module2) {
13569
13569
  "use strict";
13570
- var moment2 = module2.exports = require_moment_timezone();
13571
- moment2.tz.load(require_latest());
13570
+ var moment3 = module2.exports = require_moment_timezone();
13571
+ moment3.tz.load(require_latest());
13572
13572
  }
13573
13573
  });
13574
13574
 
@@ -118082,7 +118082,7 @@ var PositiveNumber = class _PositiveNumber {
118082
118082
  };
118083
118083
 
118084
118084
  // ../Common/Types/Date.ts
118085
- var import_moment_timezone = __toESM(require_moment_timezone2());
118085
+ var import_moment_timezone2 = __toESM(require_moment_timezone2());
118086
118086
 
118087
118087
  // ../Common/Types/Timezone.ts
118088
118088
  var Timezone = /* @__PURE__ */ ((Timezone2) => {
@@ -125298,9 +125298,351 @@ var refusedValue = /* @__PURE__ */ __name((value) => {
125298
125298
  return text.slice(0, end) + REFUSED_VALUE_CUT_MARK;
125299
125299
  }, "refusedValue");
125300
125300
 
125301
+ // ../Common/Types/DateLanguage.ts
125302
+ var import_moment_timezone = __toESM(require_moment_timezone2());
125303
+ var ENGLISH_DATE_LANGUAGE = "en";
125304
+ var displayLanguage = ENGLISH_DATE_LANGUAGE;
125305
+ var isEnglishDateLanguage = /* @__PURE__ */ __name((language) => {
125306
+ if (!language) {
125307
+ return true;
125308
+ }
125309
+ const lower = language.trim().toLowerCase();
125310
+ return lower === "" || lower === "en" || lower.startsWith("en-");
125311
+ }, "isEnglishDateLanguage");
125312
+ var normalizeLanguage = /* @__PURE__ */ __name((language) => {
125313
+ const trimmed = (language || "").trim();
125314
+ return isEnglishDateLanguage(trimmed) ? ENGLISH_DATE_LANGUAGE : trimmed;
125315
+ }, "normalizeLanguage");
125316
+ var getDateDisplayLanguage = /* @__PURE__ */ __name(() => {
125317
+ return displayLanguage;
125318
+ }, "getDateDisplayLanguage");
125319
+ function withDateDisplayLanguage(language, work) {
125320
+ const previous = displayLanguage;
125321
+ displayLanguage = normalizeLanguage(language);
125322
+ try {
125323
+ return work();
125324
+ } finally {
125325
+ displayLanguage = previous;
125326
+ }
125327
+ }
125328
+ __name(withDateDisplayLanguage, "withDateDisplayLanguage");
125329
+ var localeCache = /* @__PURE__ */ new Map();
125330
+ var getDateLocale = /* @__PURE__ */ __name((language) => {
125331
+ const requested = normalizeLanguage(language);
125332
+ const cached2 = localeCache.get(requested);
125333
+ if (cached2) {
125334
+ return cached2;
125335
+ }
125336
+ let locale = `${ENGLISH_DATE_LANGUAGE}-u-ca-gregory-nu-latn`;
125337
+ try {
125338
+ const supported = Intl.DateTimeFormat.supportedLocalesOf([
125339
+ requested
125340
+ ]);
125341
+ if (supported.length > 0 && supported[0]) {
125342
+ locale = `${supported[0]}-u-ca-gregory-nu-latn`;
125343
+ new Intl.DateTimeFormat(locale);
125344
+ }
125345
+ } catch {
125346
+ locale = `${ENGLISH_DATE_LANGUAGE}-u-ca-gregory-nu-latn`;
125347
+ }
125348
+ localeCache.set(requested, locale);
125349
+ return locale;
125350
+ }, "getDateLocale");
125351
+ var MAX_REMEMBERED_DATE_TEXTS = 5e3;
125352
+ var englishOfText = /* @__PURE__ */ new Map();
125353
+ var rememberEnglishOf = /* @__PURE__ */ __name((localized, english) => {
125354
+ if (!localized) {
125355
+ return;
125356
+ }
125357
+ englishOfText.delete(localized);
125358
+ englishOfText.set(localized, english);
125359
+ if (englishOfText.size > MAX_REMEMBERED_DATE_TEXTS) {
125360
+ const oldest = englishOfText.keys().next().value;
125361
+ if (oldest !== void 0) {
125362
+ englishOfText.delete(oldest);
125363
+ }
125364
+ }
125365
+ }, "rememberEnglishOf");
125366
+ var writeInDateDisplayLanguage = /* @__PURE__ */ __name((english, localized) => {
125367
+ const language = getDateDisplayLanguage();
125368
+ const locale = getDateLocale(language);
125369
+ if (isEnglishDateLanguage(language) || locale.startsWith(`${ENGLISH_DATE_LANGUAGE}-`)) {
125370
+ return english();
125371
+ }
125372
+ let text = null;
125373
+ try {
125374
+ text = localized(language, locale);
125375
+ } catch {
125376
+ text = null;
125377
+ }
125378
+ if (!text) {
125379
+ return english();
125380
+ }
125381
+ rememberEnglishOf(text, () => {
125382
+ return withDateDisplayLanguage(ENGLISH_DATE_LANGUAGE, english);
125383
+ });
125384
+ return text;
125385
+ }, "writeInDateDisplayLanguage");
125386
+ var dateTimeFormatCache = /* @__PURE__ */ new Map();
125387
+ var getDateTimeFormat = /* @__PURE__ */ __name((data) => {
125388
+ const zones = data.timezones.length > 0 ? data.timezones : [void 0];
125389
+ const shape = JSON.stringify(data.options);
125390
+ for (const zone of zones) {
125391
+ const key = `${data.locale}|${zone || ""}|${shape}`;
125392
+ if (dateTimeFormatCache.has(key)) {
125393
+ const cached2 = dateTimeFormatCache.get(key) || null;
125394
+ if (cached2) {
125395
+ return cached2;
125396
+ }
125397
+ continue;
125398
+ }
125399
+ try {
125400
+ const format = new Intl.DateTimeFormat(
125401
+ data.locale,
125402
+ zone ? { ...data.options, timeZone: zone } : data.options
125403
+ );
125404
+ dateTimeFormatCache.set(key, format);
125405
+ return format;
125406
+ } catch {
125407
+ dateTimeFormatCache.set(key, null);
125408
+ }
125409
+ }
125410
+ return null;
125411
+ }, "getDateTimeFormat");
125412
+ var getDateTimeOptions = /* @__PURE__ */ __name((shape) => {
125413
+ const options = {
125414
+ month: "short",
125415
+ day: shape.twoDigitDay ? "2-digit" : "numeric"
125416
+ };
125417
+ if (!shape.hideYear) {
125418
+ options.year = "numeric";
125419
+ }
125420
+ if (shape.showWeekday) {
125421
+ options.weekday = "short";
125422
+ }
125423
+ if (!shape.onlyShowDate) {
125424
+ options.hour = "2-digit";
125425
+ options.minute = "2-digit";
125426
+ options.hour12 = Boolean(shape.use12HourFormat);
125427
+ if (shape.showSeconds) {
125428
+ options.second = "2-digit";
125429
+ }
125430
+ }
125431
+ return options;
125432
+ }, "getDateTimeOptions");
125433
+ var formatDateText = /* @__PURE__ */ __name((data) => {
125434
+ if (Number.isNaN(data.date.getTime())) {
125435
+ return null;
125436
+ }
125437
+ const format = getDateTimeFormat({
125438
+ locale: data.locale,
125439
+ timezones: data.timezones,
125440
+ options: getDateTimeOptions(data.shape)
125441
+ });
125442
+ return format ? format.format(data.date) : null;
125443
+ }, "formatDateText");
125444
+ var relativeTimeFormatCache = /* @__PURE__ */ new Map();
125445
+ var getRelativeTimeFormatter = /* @__PURE__ */ __name((locale, numeric) => {
125446
+ const key = `${locale}|${numeric}`;
125447
+ if (relativeTimeFormatCache.has(key)) {
125448
+ return relativeTimeFormatCache.get(key) || null;
125449
+ }
125450
+ let formatter = null;
125451
+ try {
125452
+ const RelativeTimeFormat = Intl.RelativeTimeFormat;
125453
+ if (RelativeTimeFormat) {
125454
+ formatter = new RelativeTimeFormat(locale, {
125455
+ numeric,
125456
+ style: "long"
125457
+ });
125458
+ }
125459
+ } catch {
125460
+ formatter = null;
125461
+ }
125462
+ relativeTimeFormatCache.set(key, formatter);
125463
+ return formatter;
125464
+ }, "getRelativeTimeFormatter");
125465
+ var getRelativeDistance = /* @__PURE__ */ __name((date3, now) => {
125466
+ const isFuture = date3.getTime() - now.getTime() > 0;
125467
+ const duration2 = import_moment_timezone.default.duration({ from: now, to: date3 }).abs();
125468
+ const seconds = Math.round(duration2.as("s"));
125469
+ const minutes = Math.round(duration2.as("m"));
125470
+ const hours = Math.round(duration2.as("h"));
125471
+ const days = Math.round(duration2.as("d"));
125472
+ const months = Math.round(duration2.as("M"));
125473
+ const years = Math.round(duration2.as("y"));
125474
+ const distance = /* @__PURE__ */ __name((count, unit) => {
125475
+ return { isNow: false, count, unit, isFuture };
125476
+ }, "distance");
125477
+ if (seconds <= 44) {
125478
+ return { isNow: true, count: 0, unit: "second", isFuture };
125479
+ }
125480
+ if (minutes <= 1) {
125481
+ return distance(1, "minute");
125482
+ }
125483
+ if (minutes < 45) {
125484
+ return distance(minutes, "minute");
125485
+ }
125486
+ if (hours <= 1) {
125487
+ return distance(1, "hour");
125488
+ }
125489
+ if (hours < 22) {
125490
+ return distance(hours, "hour");
125491
+ }
125492
+ if (days <= 1) {
125493
+ return distance(1, "day");
125494
+ }
125495
+ if (days < 26) {
125496
+ return distance(days, "day");
125497
+ }
125498
+ if (months <= 1) {
125499
+ return distance(1, "month");
125500
+ }
125501
+ if (months < 11) {
125502
+ return distance(months, "month");
125503
+ }
125504
+ if (years <= 1) {
125505
+ return distance(1, "year");
125506
+ }
125507
+ return distance(years, "year");
125508
+ }, "getRelativeDistance");
125509
+ var formatRelativeDate = /* @__PURE__ */ __name((data) => {
125510
+ if (Number.isNaN(data.date.getTime())) {
125511
+ return null;
125512
+ }
125513
+ const distance = getRelativeDistance(data.date, data.now);
125514
+ if (distance.isNow) {
125515
+ const auto = getRelativeTimeFormatter(
125516
+ data.locale,
125517
+ "auto"
125518
+ );
125519
+ return auto ? auto.format(0, "second") : null;
125520
+ }
125521
+ const always = getRelativeTimeFormatter(
125522
+ data.locale,
125523
+ "always"
125524
+ );
125525
+ if (!always) {
125526
+ return null;
125527
+ }
125528
+ return always.format(
125529
+ distance.isFuture ? distance.count : -distance.count,
125530
+ distance.unit
125531
+ );
125532
+ }, "formatRelativeDate");
125533
+ var unitFormatCache = /* @__PURE__ */ new Map();
125534
+ var unitFormatCacheOwner = null;
125535
+ var getUnitFormatter = /* @__PURE__ */ __name((data) => {
125536
+ const key = `${data.locale}|${data.unit}|${data.unitDisplay}|${data.maximumFractionDigits}`;
125537
+ if (unitFormatCacheOwner !== Intl.NumberFormat) {
125538
+ unitFormatCache.clear();
125539
+ unitFormatCacheOwner = Intl.NumberFormat;
125540
+ }
125541
+ if (unitFormatCache.has(key)) {
125542
+ return unitFormatCache.get(key) || null;
125543
+ }
125544
+ let formatter = null;
125545
+ try {
125546
+ const candidate = new Intl.NumberFormat(data.locale, {
125547
+ style: "unit",
125548
+ unit: data.unit,
125549
+ unitDisplay: data.unitDisplay,
125550
+ maximumFractionDigits: data.maximumFractionDigits
125551
+ });
125552
+ const probe = candidate.format(2);
125553
+ formatter = probe === 2 .toLocaleString(data.locale) ? null : candidate;
125554
+ } catch {
125555
+ formatter = null;
125556
+ }
125557
+ unitFormatCache.set(key, formatter);
125558
+ return formatter;
125559
+ }, "getUnitFormatter");
125560
+ var formatDurationUnit = /* @__PURE__ */ __name((data) => {
125561
+ const formatter = getUnitFormatter({
125562
+ locale: data.locale,
125563
+ unit: data.part.unit,
125564
+ unitDisplay: data.unitDisplay,
125565
+ maximumFractionDigits: data.maximumFractionDigits ?? 0
125566
+ });
125567
+ return formatter ? formatter.format(data.part.count) : null;
125568
+ }, "formatDurationUnit");
125569
+ var formatDurationText = /* @__PURE__ */ __name((data) => {
125570
+ if (data.parts.length === 0) {
125571
+ return null;
125572
+ }
125573
+ const words = [];
125574
+ for (const part of data.parts) {
125575
+ const word = formatDurationUnit({
125576
+ part,
125577
+ locale: data.locale,
125578
+ unitDisplay: data.unitDisplay
125579
+ });
125580
+ if (!word) {
125581
+ return null;
125582
+ }
125583
+ words.push(word);
125584
+ }
125585
+ if (words.length === 1) {
125586
+ return words[0];
125587
+ }
125588
+ try {
125589
+ const ListFormat = Intl.ListFormat;
125590
+ if (!ListFormat) {
125591
+ return words.join(data.listStyle === "narrow" ? " " : ", ");
125592
+ }
125593
+ return new ListFormat(data.locale, {
125594
+ type: "unit",
125595
+ style: data.listStyle
125596
+ }).format(words);
125597
+ } catch {
125598
+ return words.join(data.listStyle === "narrow" ? " " : ", ");
125599
+ }
125600
+ }, "formatDurationText");
125601
+ var numberFormatCache = /* @__PURE__ */ new Map();
125602
+ var formatDecimal = /* @__PURE__ */ __name((data) => {
125603
+ const key = `${data.locale}|${data.maximumFractionDigits}`;
125604
+ if (!numberFormatCache.has(key)) {
125605
+ try {
125606
+ numberFormatCache.set(
125607
+ key,
125608
+ new Intl.NumberFormat(data.locale, {
125609
+ maximumFractionDigits: data.maximumFractionDigits,
125610
+ useGrouping: false
125611
+ })
125612
+ );
125613
+ } catch {
125614
+ numberFormatCache.set(key, null);
125615
+ }
125616
+ }
125617
+ const format = numberFormatCache.get(key) || null;
125618
+ return format ? format.format(data.value) : null;
125619
+ }, "formatDecimal");
125620
+
125301
125621
  // ../Common/Types/Date.ts
125302
- var Moment = import_moment_timezone.default;
125622
+ var Moment = import_moment_timezone2.default;
125623
+ var LOCALIZED_CUSTOM_DATE_FORMATS = {
125624
+ "MMM D": { month: "short", day: "numeric" },
125625
+ "MMM DD": { month: "short", day: "2-digit" },
125626
+ "MMM D, YYYY": { month: "short", day: "numeric", year: "numeric" },
125627
+ "MMM DD, YYYY": { month: "short", day: "2-digit", year: "numeric" },
125628
+ "MMM DD YYYY": { month: "short", day: "2-digit", year: "numeric" },
125629
+ "MMM YYYY": { month: "short", year: "numeric" },
125630
+ "MMMM YYYY": { month: "long", year: "numeric" },
125631
+ "MMMM D, YYYY": { month: "long", day: "numeric", year: "numeric" },
125632
+ "h:mm A": { hour: "numeric", minute: "2-digit", hour12: true },
125633
+ "hh:mm A": { hour: "2-digit", minute: "2-digit", hour12: true }
125634
+ };
125303
125635
  var UNIX_NANO_INTEGER_PATTERN = /^[+-]?\d+$/;
125636
+ var DURATION_DECIMAL_POINT = /(\d)\.(\d)/g;
125637
+ var DIGITS = /\d/g;
125638
+ var FRIENDLY_TIME_ENGLISH_UNITS = {
125639
+ year: ["year", "years"],
125640
+ month: ["month", "months"],
125641
+ day: ["day", "days"],
125642
+ hour: ["hour", "hours"],
125643
+ minute: ["min", "mins"],
125644
+ second: ["sec", "secs"]
125645
+ };
125304
125646
  var nanosPerMillisecond;
125305
125647
  var CLICKHOUSE_DATE_TIME_MEMO_SLOTS = 256;
125306
125648
  var clickhouseDateTimeMemoSeconds = new Float64Array(
@@ -125344,12 +125686,14 @@ var OneUptimeDate = class _OneUptimeDate {
125344
125686
  }
125345
125687
  static getLocalShortMonthName(date3) {
125346
125688
  const timezone = this.getCurrentTimezone();
125689
+ const language = getDateDisplayLanguage();
125690
+ const locale = isEnglishDateLanguage(language) ? "default" : getDateLocale(language);
125347
125691
  for (const name of [
125348
125692
  timezone,
125349
125693
  ...TimezoneAlias.getLegacyNamesOf(timezone)
125350
125694
  ]) {
125351
125695
  try {
125352
- return date3.toLocaleString("default", {
125696
+ return date3.toLocaleString(locale, {
125353
125697
  month: "short",
125354
125698
  timeZone: name.toString()
125355
125699
  });
@@ -125358,6 +125702,39 @@ var OneUptimeDate = class _OneUptimeDate {
125358
125702
  }
125359
125703
  return this.inCurrentTimezone(date3).format("MMM");
125360
125704
  }
125705
+ /*
125706
+ * The current timezone and its legacy spellings, for Intl: an engine with
125707
+ * tzdata before 2022b throws a RangeError for "Europe/Kyiv", which is what
125708
+ * getCurrentTimezone reports for a browser that says "Europe/Kiev", but
125709
+ * knows the legacy name.
125710
+ */
125711
+ static getCurrentTimezoneNames() {
125712
+ return this.getTimezoneNames(this.getCurrentTimezone());
125713
+ }
125714
+ static getTimezoneNames(timezone) {
125715
+ return [
125716
+ timezone.toString(),
125717
+ ...TimezoneAlias.getLegacyNamesOf(timezone).map(
125718
+ (name) => {
125719
+ return name.toString();
125720
+ }
125721
+ )
125722
+ ];
125723
+ }
125724
+ /*
125725
+ * `date` in the reader's language, in the shape asked for, read in the
125726
+ * current timezone (or the runtime's own zone with `timezones` empty).
125727
+ * Null when the language is English or Intl cannot write it: the caller
125728
+ * then writes moment's English.
125729
+ */
125730
+ static getLocalizedDateText(data) {
125731
+ return formatDateText({
125732
+ date: data.date,
125733
+ locale: data.locale,
125734
+ timezones: data.timezones ?? this.getCurrentTimezoneNames(),
125735
+ shape: data.shape
125736
+ });
125737
+ }
125361
125738
  static getSchema() {
125362
125739
  return Zod_default.object({
125363
125740
  _type: Zod_default.literal("DateTime" /* DateTime */),
@@ -125383,14 +125760,41 @@ var OneUptimeDate = class _OneUptimeDate {
125383
125760
  static getHoursAndMinutesFromMinutes(minutes) {
125384
125761
  const hours = Math.floor(minutes / 60);
125385
125762
  const mins = minutes % 60;
125386
- let formattedString = "";
125387
- if (hours > 0) {
125388
- formattedString += hours + " hours ";
125389
- }
125390
- if (mins > 0) {
125391
- formattedString += mins + " minutes";
125392
- }
125393
- return formattedString.trim() || "0 minutes";
125763
+ return writeInDateDisplayLanguage(
125764
+ () => {
125765
+ let formattedString = "";
125766
+ if (hours > 0) {
125767
+ formattedString += hours + " hours ";
125768
+ }
125769
+ if (mins > 0) {
125770
+ formattedString += mins + " minutes";
125771
+ }
125772
+ return formattedString.trim() || "0 minutes";
125773
+ },
125774
+ (_language, locale) => {
125775
+ const parts = [];
125776
+ if (hours > 0) {
125777
+ parts.push({ count: hours, unit: "hour" });
125778
+ }
125779
+ if (mins > 0) {
125780
+ parts.push({ count: mins, unit: "minute" });
125781
+ }
125782
+ return this.formatLocalizedDuration(
125783
+ parts.length > 0 ? parts : [{ count: 0, unit: "minute" }],
125784
+ locale,
125785
+ "long",
125786
+ "narrow"
125787
+ );
125788
+ }
125789
+ );
125790
+ }
125791
+ /*
125792
+ * A duration's parts in `locale`: "2 Tage, 3 Stunden", or with `listStyle`
125793
+ * "narrow" as a compact reading joins them ("2 Std. 5 Min."). Null when
125794
+ * Intl cannot write one of the units, and the caller writes English.
125795
+ */
125796
+ static formatLocalizedDuration(parts, locale, unitDisplay, listStyle) {
125797
+ return formatDurationText({ parts, locale, unitDisplay, listStyle });
125394
125798
  }
125395
125799
  static fromUnixTimestamp(timestamp) {
125396
125800
  return new Date(timestamp * 1e3);
@@ -125398,13 +125802,13 @@ var OneUptimeDate = class _OneUptimeDate {
125398
125802
  static getStartOfTheWeek(date3, timezone) {
125399
125803
  date3 = this.fromString(date3);
125400
125804
  if (timezone) {
125401
- return import_moment_timezone.default.tz(date3, timezone).startOf("week").toDate();
125805
+ return import_moment_timezone2.default.tz(date3, timezone).startOf("week").toDate();
125402
125806
  }
125403
- return (0, import_moment_timezone.default)(date3).startOf("week").toDate();
125807
+ return (0, import_moment_timezone2.default)(date3).startOf("week").toDate();
125404
125808
  }
125405
125809
  static getEndOfTheWeek(date3) {
125406
125810
  date3 = this.fromString(date3);
125407
- return (0, import_moment_timezone.default)(date3).endOf("week").toDate();
125811
+ return (0, import_moment_timezone2.default)(date3).endOf("week").toDate();
125408
125812
  }
125409
125813
  static getInBetweenDatesAsFormattedString(inBetween) {
125410
125814
  return this.getDateAsFormattedString(inBetween.startValue) + " - " + this.getDateAsFormattedString(inBetween.endValue);
@@ -125419,7 +125823,7 @@ var OneUptimeDate = class _OneUptimeDate {
125419
125823
  return this.getCurrentDate();
125420
125824
  }
125421
125825
  static getDateFromYYYYMMDD(year, month, day) {
125422
- return (0, import_moment_timezone.default)(`${year}-${month}-${day}`).toDate();
125826
+ return (0, import_moment_timezone2.default)(`${year}-${month}-${day}`).toDate();
125423
125827
  }
125424
125828
  getMicroSecondsFromSeconds(seconds) {
125425
125829
  return seconds * 1e3 * 1e3;
@@ -125481,10 +125885,24 @@ var OneUptimeDate = class _OneUptimeDate {
125481
125885
  return this.inCurrentTimezone(date3).format(timeFormat);
125482
125886
  }
125483
125887
  static getDateAsLocalDayMonthString(date3) {
125484
- date3 = this.fromString(date3);
125485
- const day = this.padDatePart(this.inCurrentTimezone(date3).date());
125486
- const month = this.getLocalShortMonthName(date3);
125487
- return `${day} ${month}`;
125888
+ const instant = this.fromString(date3);
125889
+ return writeInDateDisplayLanguage(
125890
+ () => {
125891
+ const day = this.padDatePart(
125892
+ this.inCurrentTimezone(instant).date()
125893
+ );
125894
+ const month = this.getLocalShortMonthName(instant);
125895
+ return `${day} ${month}`;
125896
+ },
125897
+ (language, locale) => {
125898
+ return this.getLocalizedDateText({
125899
+ date: instant,
125900
+ language,
125901
+ locale,
125902
+ shape: { onlyShowDate: true, hideYear: true, twoDigitDay: true }
125903
+ });
125904
+ }
125905
+ );
125488
125906
  }
125489
125907
  static getDateAsLocalDayMonthHourString(date3) {
125490
125908
  date3 = this.fromString(date3);
@@ -125542,13 +125960,42 @@ var OneUptimeDate = class _OneUptimeDate {
125542
125960
  if (use12HourFormat) {
125543
125961
  timeFormat += " A";
125544
125962
  }
125545
- return this.inCurrentTimezone(date3).format(`MMM D, ${timeFormat}`);
125963
+ const instant = date3;
125964
+ return writeInDateDisplayLanguage(
125965
+ () => {
125966
+ return this.inCurrentTimezone(instant).format(`MMM D, ${timeFormat}`);
125967
+ },
125968
+ (language, locale) => {
125969
+ return this.getLocalizedDateText({
125970
+ date: instant,
125971
+ language,
125972
+ locale,
125973
+ shape: {
125974
+ hideYear: true,
125975
+ use12HourFormat,
125976
+ showSeconds: Boolean(options?.includeSeconds)
125977
+ }
125978
+ });
125979
+ }
125980
+ );
125546
125981
  }
125547
125982
  static getDateAsLocalMonthYearString(date3) {
125548
- date3 = this.fromString(date3);
125549
- const month = this.getLocalShortMonthName(date3);
125550
- const year = this.inCurrentTimezone(date3).year().toString();
125551
- return `${month} ${year}`;
125983
+ const instant = this.fromString(date3);
125984
+ return writeInDateDisplayLanguage(
125985
+ () => {
125986
+ const month = this.getLocalShortMonthName(instant);
125987
+ const year = this.inCurrentTimezone(instant).year().toString();
125988
+ return `${month} ${year}`;
125989
+ },
125990
+ (_language, locale) => {
125991
+ const format = getDateTimeFormat({
125992
+ locale,
125993
+ timezones: this.getCurrentTimezoneNames(),
125994
+ options: { month: "short", year: "numeric" }
125995
+ });
125996
+ return format ? format.format(instant) : null;
125997
+ }
125998
+ );
125552
125999
  }
125553
126000
  static getMillisecondsBetweenTwoUnixNanoDates(startDate, endDate) {
125554
126001
  return endDate - startDate;
@@ -125570,7 +126017,7 @@ var OneUptimeDate = class _OneUptimeDate {
125570
126017
  }
125571
126018
  static getDayOfTheWeekIndex(date3) {
125572
126019
  date3 = this.fromString(date3);
125573
- return (0, import_moment_timezone.default)(date3).weekday();
126020
+ return (0, import_moment_timezone2.default)(date3).weekday();
125574
126021
  }
125575
126022
  /**
125576
126023
  * Format the wall-clock time (HH:mm, respecting the 12/24h preference) of an
@@ -125584,7 +126031,7 @@ var OneUptimeDate = class _OneUptimeDate {
125584
126031
  return this.getLocalHourAndMinuteFromDate(date3);
125585
126032
  }
125586
126033
  const use12HourFormat = this.getUserPrefers12HourFormat();
125587
- return import_moment_timezone.default.tz(date3, timezone).format(use12HourFormat ? "h:mm A" : "HH:mm");
126034
+ return import_moment_timezone2.default.tz(date3, timezone).format(use12HourFormat ? "h:mm A" : "HH:mm");
125588
126035
  }
125589
126036
  /**
125590
126037
  * Format a single instant as a human-readable "weekday, month day, time"
@@ -125599,6 +126046,40 @@ var OneUptimeDate = class _OneUptimeDate {
125599
126046
  static getDateAsFormattedStringInTimezone(data) {
125600
126047
  const date3 = this.fromString(data.date);
125601
126048
  const use12HourFormat = data.use12HourFormat ?? this.getUserPrefers12HourFormat();
126049
+ return writeInDateDisplayLanguage(
126050
+ () => {
126051
+ return this.getEnglishDateInTimezone({
126052
+ date: date3,
126053
+ timezone: data.timezone,
126054
+ onlyShowDate: data.onlyShowDate,
126055
+ showWeekday: data.showWeekday,
126056
+ use12HourFormat
126057
+ });
126058
+ },
126059
+ (language, locale) => {
126060
+ const timezone = data.timezone || this.getCurrentTimezone();
126061
+ const text = this.getLocalizedDateText({
126062
+ date: date3,
126063
+ language,
126064
+ locale,
126065
+ shape: {
126066
+ onlyShowDate: data.onlyShowDate,
126067
+ showWeekday: data.showWeekday,
126068
+ use12HourFormat
126069
+ },
126070
+ timezones: this.getTimezoneNames(timezone)
126071
+ });
126072
+ if (!text || data.onlyShowDate) {
126073
+ return text;
126074
+ }
126075
+ return `${text} ${this.getZoneAbbrByTimezone(timezone, date3)}`.trim();
126076
+ }
126077
+ );
126078
+ }
126079
+ // getDateAsFormattedStringInTimezone's English, as moment writes it.
126080
+ static getEnglishDateInTimezone(data) {
126081
+ const date3 = data.date;
126082
+ const use12HourFormat = data.use12HourFormat;
125602
126083
  const timePart = use12HourFormat ? "h:mm A" : "HH:mm";
125603
126084
  const datePart = data.showWeekday ? "ddd, MMM D, YYYY" : "MMM D, YYYY";
125604
126085
  const formatString = data.onlyShowDate ? datePart : `${datePart}, ${timePart}`;
@@ -125609,7 +126090,7 @@ var OneUptimeDate = class _OneUptimeDate {
125609
126090
  " " + this.getZoneAbbrByTimezone(this.getCurrentTimezone(), date3)
125610
126091
  ))).trim();
125611
126092
  }
125612
- const zoned = (0, import_moment_timezone.default)(date3).tz(data.timezone);
126093
+ const zoned = (0, import_moment_timezone2.default)(date3).tz(data.timezone);
125613
126094
  return (zoned.format(formatString) + (data.onlyShowDate ? "" : " " + this.getZoneAbbrByTimezone(data.timezone, date3))).trim();
125614
126095
  }
125615
126096
  /*
@@ -125621,10 +126102,27 @@ var OneUptimeDate = class _OneUptimeDate {
125621
126102
  */
125622
126103
  static getDateAsCustomFormattedStringInTimezone(data) {
125623
126104
  const date3 = this.fromString(data.date);
125624
- if (!data.timezone) {
125625
- return this.inCurrentTimezone(date3).format(data.format);
125626
- }
125627
- return (0, import_moment_timezone.default)(date3).tz(data.timezone).format(data.format);
126105
+ const english = /* @__PURE__ */ __name(() => {
126106
+ if (!data.timezone) {
126107
+ return this.inCurrentTimezone(date3).format(data.format);
126108
+ }
126109
+ return (0, import_moment_timezone2.default)(date3).tz(data.timezone).format(data.format);
126110
+ }, "english");
126111
+ const options = LOCALIZED_CUSTOM_DATE_FORMATS[data.format];
126112
+ if (!options) {
126113
+ return english();
126114
+ }
126115
+ return writeInDateDisplayLanguage(
126116
+ english,
126117
+ (_language, locale) => {
126118
+ const format = getDateTimeFormat({
126119
+ locale,
126120
+ timezones: data.timezone ? this.getTimezoneNames(data.timezone) : this.getCurrentTimezoneNames(),
126121
+ options
126122
+ });
126123
+ return format ? format.format(date3) : null;
126124
+ }
126125
+ );
125628
126126
  }
125629
126127
  /**
125630
126128
  * Reinterpret the wall-clock components of `date` — read in the CURRENT
@@ -125640,7 +126138,7 @@ var OneUptimeDate = class _OneUptimeDate {
125640
126138
  */
125641
126139
  static getInstantFromLocalWallClockInTimezone(date3, timezone) {
125642
126140
  const local = this.inCurrentTimezone(date3);
125643
- return import_moment_timezone.default.tz(
126141
+ return import_moment_timezone2.default.tz(
125644
126142
  {
125645
126143
  year: local.year(),
125646
126144
  month: local.month(),
@@ -125664,8 +126162,8 @@ var OneUptimeDate = class _OneUptimeDate {
125664
126162
  */
125665
126163
  static getLocalDateFromWallClockInTimezone(date3, timezone) {
125666
126164
  date3 = this.fromString(date3);
125667
- const zoned = import_moment_timezone.default.tz(date3, timezone);
125668
- return import_moment_timezone.default.tz(
126165
+ const zoned = import_moment_timezone2.default.tz(date3, timezone);
126166
+ return import_moment_timezone2.default.tz(
125669
126167
  {
125670
126168
  year: zoned.year(),
125671
126169
  month: zoned.month(),
@@ -125692,7 +126190,7 @@ var OneUptimeDate = class _OneUptimeDate {
125692
126190
  */
125693
126191
  static getBrowserLocalDateFromWallClockInTimezone(date3, timezone) {
125694
126192
  date3 = this.fromString(date3);
125695
- const zoned = import_moment_timezone.default.tz(date3, timezone);
126193
+ const zoned = import_moment_timezone2.default.tz(date3, timezone);
125696
126194
  return new Date(
125697
126195
  zoned.year(),
125698
126196
  zoned.month(),
@@ -125711,7 +126209,7 @@ var OneUptimeDate = class _OneUptimeDate {
125711
126209
  */
125712
126210
  static getInstantFromBrowserLocalWallClockInTimezone(date3, timezone) {
125713
126211
  date3 = this.fromString(date3);
125714
- return import_moment_timezone.default.tz(
126212
+ return import_moment_timezone2.default.tz(
125715
126213
  {
125716
126214
  year: date3.getFullYear(),
125717
126215
  month: date3.getMonth(),
@@ -125728,17 +126226,32 @@ var OneUptimeDate = class _OneUptimeDate {
125728
126226
  end = this.fromString(end);
125729
126227
  start1 = this.fromString(start1);
125730
126228
  end1 = this.fromString(end1);
125731
- let isOverlapping = (0, import_moment_timezone.default)(start).isBetween(start1, end1) || (0, import_moment_timezone.default)(end).isBetween(start1, end1) || (0, import_moment_timezone.default)(start).isSame(start1) || (0, import_moment_timezone.default)(end).isSame(end1);
126229
+ let isOverlapping = (0, import_moment_timezone2.default)(start).isBetween(start1, end1) || (0, import_moment_timezone2.default)(end).isBetween(start1, end1) || (0, import_moment_timezone2.default)(start).isSame(start1) || (0, import_moment_timezone2.default)(end).isSame(end1);
125732
126230
  if (!isOverlapping) {
125733
- isOverlapping = (0, import_moment_timezone.default)(start1).isBetween(start, end) || (0, import_moment_timezone.default)(end1).isBetween(start, end) || (0, import_moment_timezone.default)(start1).isSame(start) || (0, import_moment_timezone.default)(end1).isSame(end);
126231
+ isOverlapping = (0, import_moment_timezone2.default)(start1).isBetween(start, end) || (0, import_moment_timezone2.default)(end1).isBetween(start, end) || (0, import_moment_timezone2.default)(start1).isSame(start) || (0, import_moment_timezone2.default)(end1).isSame(end);
125734
126232
  }
125735
126233
  return isOverlapping;
125736
126234
  }
125737
126235
  static getCurrentDate() {
125738
126236
  return /* @__PURE__ */ new Date();
125739
126237
  }
126238
+ /*
126239
+ * "5 hours ago", "in 3 days" - in the reader's language when a frontend set
126240
+ * one ("vor 5 Stunden"), rounded as moment rounds it.
126241
+ */
125740
126242
  static fromNow(date3) {
125741
- return (0, import_moment_timezone.default)(date3).fromNow();
126243
+ return writeInDateDisplayLanguage(
126244
+ () => {
126245
+ return (0, import_moment_timezone2.default)(date3).fromNow();
126246
+ },
126247
+ (_language, locale) => {
126248
+ return formatRelativeDate({
126249
+ date: this.fromString(date3),
126250
+ now: /* @__PURE__ */ new Date(),
126251
+ locale
126252
+ });
126253
+ }
126254
+ );
125742
126255
  }
125743
126256
  static differenceBetweenTwoDatesAsFromattedString(date1, date22) {
125744
126257
  const seconds = this.getSecondsBetweenTwoDates(date1, date22);
@@ -125749,17 +126262,17 @@ var OneUptimeDate = class _OneUptimeDate {
125749
126262
  date3 = this.fromString(date3);
125750
126263
  }
125751
126264
  const format = use12HourFormat || this.getUserPrefers12HourFormat() ? "hh:mm A" : "HH:mm";
125752
- return (0, import_moment_timezone.default)(date3).format(format);
126265
+ return (0, import_moment_timezone2.default)(date3).format(format);
125753
126266
  }
125754
126267
  static isSame(date1, date22) {
125755
126268
  date1 = this.fromString(date1);
125756
126269
  date22 = this.fromString(date22);
125757
- return (0, import_moment_timezone.default)(date1).isSame(date22);
126270
+ return (0, import_moment_timezone2.default)(date1).isSame(date22);
125758
126271
  }
125759
126272
  static getDaysBetweenTwoDates(startDate, endDate) {
125760
126273
  startDate = this.fromString(startDate);
125761
126274
  endDate = this.fromString(endDate);
125762
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "days");
126275
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "days");
125763
126276
  }
125764
126277
  static getDaysBetweenTwoDatesInclusive(startDate, endDate) {
125765
126278
  return this.getDaysBetweenTwoDates(startDate, endDate) + 1;
@@ -125767,7 +126280,7 @@ var OneUptimeDate = class _OneUptimeDate {
125767
126280
  static getHoursBetweenTwoDates(startDate, endDate) {
125768
126281
  startDate = this.fromString(startDate);
125769
126282
  endDate = this.fromString(endDate);
125770
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "hours");
126283
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "hours");
125771
126284
  }
125772
126285
  static getHoursBetweenTwoDatesInclusive(startDate, endDate) {
125773
126286
  return this.getHoursBetweenTwoDates(startDate, endDate) + 1;
@@ -125775,7 +126288,7 @@ var OneUptimeDate = class _OneUptimeDate {
125775
126288
  static getMinutesBetweenTwoDates(startDate, endDate) {
125776
126289
  startDate = this.fromString(startDate);
125777
126290
  endDate = this.fromString(endDate);
125778
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "minutes");
126291
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "minutes");
125779
126292
  }
125780
126293
  static getMinutesBetweenTwoDatesInclusive(startDate, endDate) {
125781
126294
  return this.getMinutesBetweenTwoDates(startDate, endDate) + 1;
@@ -125783,7 +126296,7 @@ var OneUptimeDate = class _OneUptimeDate {
125783
126296
  static getSecondsBetweenTwoDates(startDate, endDate) {
125784
126297
  startDate = this.fromString(startDate);
125785
126298
  endDate = this.fromString(endDate);
125786
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "seconds");
126299
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "seconds");
125787
126300
  }
125788
126301
  static getSecondsBetweenTwoDatesInclusive(startDate, endDate) {
125789
126302
  return this.getSecondsBetweenTwoDates(startDate, endDate) + 1;
@@ -125791,7 +126304,7 @@ var OneUptimeDate = class _OneUptimeDate {
125791
126304
  static getWeeksBetweenTwoDates(startDate, endDate) {
125792
126305
  startDate = this.fromString(startDate);
125793
126306
  endDate = this.fromString(endDate);
125794
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "weeks");
126307
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "weeks");
125795
126308
  }
125796
126309
  static getWeeksBetweenTwoDatesInclusive(startDate, endDate) {
125797
126310
  return this.getWeeksBetweenTwoDates(startDate, endDate) + 1;
@@ -125799,7 +126312,7 @@ var OneUptimeDate = class _OneUptimeDate {
125799
126312
  static getMonthsBetweenTwoDates(startDate, endDate) {
125800
126313
  startDate = this.fromString(startDate);
125801
126314
  endDate = this.fromString(endDate);
125802
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "months");
126315
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "months");
125803
126316
  }
125804
126317
  static getMonthsBetweenTwoDatesInclusive(startDate, endDate) {
125805
126318
  return this.getMonthsBetweenTwoDates(startDate, endDate) + 1;
@@ -125807,7 +126320,7 @@ var OneUptimeDate = class _OneUptimeDate {
125807
126320
  static getYearsBetweenTwoDates(startDate, endDate) {
125808
126321
  startDate = this.fromString(startDate);
125809
126322
  endDate = this.fromString(endDate);
125810
- return (0, import_moment_timezone.default)(endDate).diff((0, import_moment_timezone.default)(startDate), "years");
126323
+ return (0, import_moment_timezone2.default)(endDate).diff((0, import_moment_timezone2.default)(startDate), "years");
125811
126324
  }
125812
126325
  static getYearsBetweenTwoDatesInclusive(startDate, endDate) {
125813
126326
  return this.getYearsBetweenTwoDates(startDate, endDate) + 1;
@@ -125850,21 +126363,21 @@ var OneUptimeDate = class _OneUptimeDate {
125850
126363
  return parsedDate.toISOString();
125851
126364
  }
125852
126365
  static getCurrentMomentDate() {
125853
- return (0, import_moment_timezone.default)();
126366
+ return (0, import_moment_timezone2.default)();
125854
126367
  }
125855
126368
  static keepTimeButMoveDay(keepTimeFor, moveDayTo, timezone) {
125856
126369
  keepTimeFor = this.fromString(keepTimeFor);
125857
126370
  moveDayTo = this.fromString(moveDayTo);
125858
126371
  if (timezone) {
125859
- const src = import_moment_timezone.default.tz(keepTimeFor, timezone);
125860
- return import_moment_timezone.default.tz(moveDayTo, timezone).set({
126372
+ const src = import_moment_timezone2.default.tz(keepTimeFor, timezone);
126373
+ return import_moment_timezone2.default.tz(moveDayTo, timezone).set({
125861
126374
  hour: src.hour(),
125862
126375
  minute: src.minute(),
125863
126376
  second: src.second(),
125864
126377
  millisecond: src.millisecond()
125865
126378
  }).toDate();
125866
126379
  }
125867
- return (0, import_moment_timezone.default)(moveDayTo).set({
126380
+ return (0, import_moment_timezone2.default)(moveDayTo).set({
125868
126381
  hour: keepTimeFor.getHours(),
125869
126382
  minute: keepTimeFor.getMinutes(),
125870
126383
  second: keepTimeFor.getSeconds(),
@@ -125957,7 +126470,7 @@ var OneUptimeDate = class _OneUptimeDate {
125957
126470
  * hours off.
125958
126471
  */
125959
126472
  static fromDateTimeLocalString(value) {
125960
- return import_moment_timezone.default.tz(value.trim(), this.getCurrentTimezone().toString()).toDate();
126473
+ return import_moment_timezone2.default.tz(value.trim(), this.getCurrentTimezone().toString()).toDate();
125961
126474
  }
125962
126475
  static fromJSON(json) {
125963
126476
  if (json["_type"] === "DateTime" /* DateTime */) {
@@ -125974,7 +126487,7 @@ var OneUptimeDate = class _OneUptimeDate {
125974
126487
  static areOnTheSameDay(date1, date22) {
125975
126488
  date1 = this.fromString(date1);
125976
126489
  date22 = this.fromString(date22);
125977
- return (0, import_moment_timezone.default)(date1).isSame(date22, "day");
126490
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "day");
125978
126491
  }
125979
126492
  /**
125980
126493
  * Whether the two instants fall on the same calendar day *in the current
@@ -125994,36 +126507,36 @@ var OneUptimeDate = class _OneUptimeDate {
125994
126507
  static areOnTheSameMonth(date1, date22) {
125995
126508
  date1 = this.fromString(date1);
125996
126509
  date22 = this.fromString(date22);
125997
- return (0, import_moment_timezone.default)(date1).isSame(date22, "month");
126510
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "month");
125998
126511
  }
125999
126512
  static areOnTheSameYear(date1, date22) {
126000
126513
  date1 = this.fromString(date1);
126001
126514
  date22 = this.fromString(date22);
126002
- return (0, import_moment_timezone.default)(date1).isSame(date22, "year");
126515
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "year");
126003
126516
  }
126004
126517
  static areOnTheSameHour(date1, date22) {
126005
126518
  date1 = this.fromString(date1);
126006
126519
  date22 = this.fromString(date22);
126007
- return (0, import_moment_timezone.default)(date1).isSame(date22, "hour");
126520
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "hour");
126008
126521
  }
126009
126522
  static areOnTheSameMinute(date1, date22) {
126010
126523
  date1 = this.fromString(date1);
126011
126524
  date22 = this.fromString(date22);
126012
- return (0, import_moment_timezone.default)(date1).isSame(date22, "minute");
126525
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "minute");
126013
126526
  }
126014
126527
  static areOnTheSameSecond(date1, date22) {
126015
126528
  date1 = this.fromString(date1);
126016
126529
  date22 = this.fromString(date22);
126017
- return (0, import_moment_timezone.default)(date1).isSame(date22, "second");
126530
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "second");
126018
126531
  }
126019
126532
  static areOnTheSameWeek(date1, date22) {
126020
126533
  date1 = this.fromString(date1);
126021
126534
  date22 = this.fromString(date22);
126022
- return (0, import_moment_timezone.default)(date1).isSame(date22, "week");
126535
+ return (0, import_moment_timezone2.default)(date1).isSame(date22, "week");
126023
126536
  }
126024
126537
  static addRemoveMinutes(date3, minutes) {
126025
126538
  date3 = this.fromString(date3);
126026
- return (0, import_moment_timezone.default)(date3).add(minutes, "minutes").toDate();
126539
+ return (0, import_moment_timezone2.default)(date3).add(minutes, "minutes").toDate();
126027
126540
  }
126028
126541
  /*
126029
126542
  * Calendar-unit arithmetic. When `timezone` is provided the step preserves
@@ -126037,38 +126550,38 @@ var OneUptimeDate = class _OneUptimeDate {
126037
126550
  static addRemoveDays(date3, days, timezone) {
126038
126551
  date3 = this.fromString(date3);
126039
126552
  if (timezone) {
126040
- return import_moment_timezone.default.tz(date3, timezone).add(days, "days").toDate();
126553
+ return import_moment_timezone2.default.tz(date3, timezone).add(days, "days").toDate();
126041
126554
  }
126042
- return (0, import_moment_timezone.default)(date3).add(days, "days").toDate();
126555
+ return (0, import_moment_timezone2.default)(date3).add(days, "days").toDate();
126043
126556
  }
126044
126557
  static addRemoveHours(date3, hours) {
126045
126558
  date3 = this.fromString(date3);
126046
- return (0, import_moment_timezone.default)(date3).add(hours, "hours").toDate();
126559
+ return (0, import_moment_timezone2.default)(date3).add(hours, "hours").toDate();
126047
126560
  }
126048
126561
  static addRemoveYears(date3, years, timezone) {
126049
126562
  date3 = this.fromString(date3);
126050
126563
  if (timezone) {
126051
- return import_moment_timezone.default.tz(date3, timezone).add(years, "years").toDate();
126564
+ return import_moment_timezone2.default.tz(date3, timezone).add(years, "years").toDate();
126052
126565
  }
126053
- return (0, import_moment_timezone.default)(date3).add(years, "years").toDate();
126566
+ return (0, import_moment_timezone2.default)(date3).add(years, "years").toDate();
126054
126567
  }
126055
126568
  static addRemoveMonths(date3, months, timezone) {
126056
126569
  date3 = this.fromString(date3);
126057
126570
  if (timezone) {
126058
- return import_moment_timezone.default.tz(date3, timezone).add(months, "months").toDate();
126571
+ return import_moment_timezone2.default.tz(date3, timezone).add(months, "months").toDate();
126059
126572
  }
126060
- return (0, import_moment_timezone.default)(date3).add(months, "months").toDate();
126573
+ return (0, import_moment_timezone2.default)(date3).add(months, "months").toDate();
126061
126574
  }
126062
126575
  static addRemoveWeeks(date3, weeks, timezone) {
126063
126576
  date3 = this.fromString(date3);
126064
126577
  if (timezone) {
126065
- return import_moment_timezone.default.tz(date3, timezone).add(weeks, "weeks").toDate();
126578
+ return import_moment_timezone2.default.tz(date3, timezone).add(weeks, "weeks").toDate();
126066
126579
  }
126067
- return (0, import_moment_timezone.default)(date3).add(weeks, "weeks").toDate();
126580
+ return (0, import_moment_timezone2.default)(date3).add(weeks, "weeks").toDate();
126068
126581
  }
126069
126582
  static addRemoveSeconds(date3, seconds) {
126070
126583
  date3 = this.fromString(date3);
126071
- return (0, import_moment_timezone.default)(date3).add(seconds, "seconds").toDate();
126584
+ return (0, import_moment_timezone2.default)(date3).add(seconds, "seconds").toDate();
126072
126585
  }
126073
126586
  static getSecondsInDays(days) {
126074
126587
  if (!(days instanceof PositiveNumber)) {
@@ -126105,21 +126618,21 @@ var OneUptimeDate = class _OneUptimeDate {
126105
126618
  if (!(days instanceof PositiveNumber)) {
126106
126619
  days = new PositiveNumber(days);
126107
126620
  }
126108
- return (0, import_moment_timezone.default)(date3).add(-1 * days.toNumber(), "days").toDate();
126621
+ return (0, import_moment_timezone2.default)(date3).add(-1 * days.toNumber(), "days").toDate();
126109
126622
  }
126110
126623
  static getSomeDaysAfterFromDate(date3, days) {
126111
126624
  date3 = this.fromString(date3);
126112
126625
  if (!(days instanceof PositiveNumber)) {
126113
126626
  days = new PositiveNumber(days);
126114
126627
  }
126115
- return (0, import_moment_timezone.default)(date3).add(Number(days.toNumber()), "days").toDate();
126628
+ return (0, import_moment_timezone2.default)(date3).add(Number(days.toNumber()), "days").toDate();
126116
126629
  }
126117
126630
  static getSomeDaysBeforeFromDate(date3, days) {
126118
126631
  date3 = this.fromString(date3);
126119
126632
  if (!(days instanceof PositiveNumber)) {
126120
126633
  days = new PositiveNumber(days);
126121
126634
  }
126122
- return (0, import_moment_timezone.default)(date3).add(-1 * Number(days.toNumber()), "days").toDate();
126635
+ return (0, import_moment_timezone2.default)(date3).add(-1 * Number(days.toNumber()), "days").toDate();
126123
126636
  }
126124
126637
  static getSomeSecondsAgo(seconds) {
126125
126638
  if (!(seconds instanceof PositiveNumber)) {
@@ -126152,70 +126665,51 @@ var OneUptimeDate = class _OneUptimeDate {
126152
126665
  return this.getCurrentMomentDate().add(days.toNumber(), "days").toDate();
126153
126666
  }
126154
126667
  static secondsToFormattedTimeString(seconds) {
126155
- return import_moment_timezone.default.utc(seconds * 1e3).format("HH:mm:ss");
126668
+ return import_moment_timezone2.default.utc(seconds * 1e3).format("HH:mm:ss");
126156
126669
  }
126157
126670
  static toUnixTimestamp(date3) {
126158
126671
  return Math.floor(date3.getTime() / 1e3);
126159
126672
  }
126673
+ /*
126674
+ * "1 year 2 months 3 days 4 hours 5 mins 6 secs", each unit that is not
126675
+ * zero, counted on the calendar from the epoch - and in the reader's
126676
+ * language when a frontend set one ("1 J. 2 Mon. 3 Tg.").
126677
+ */
126160
126678
  static secondsToFormattedFriendlyTimeString(seconds) {
126161
- const startDate = import_moment_timezone.default.utc(0);
126162
- const date3 = import_moment_timezone.default.utc(seconds * 1e3);
126163
- let formattedString = "";
126164
- const years = date3.diff(startDate, "years");
126165
- if (years > 0) {
126166
- let text = "years ";
126167
- if (years === 1) {
126168
- text = "year ";
126169
- }
126170
- startDate.add(years, "years");
126171
- formattedString += years + " " + text;
126172
- }
126173
- const months = date3.diff(startDate, "months");
126174
- if (months > 0) {
126175
- let text = "months ";
126176
- if (months === 1) {
126177
- text = "month ";
126178
- }
126179
- startDate.add(months, "months");
126180
- formattedString += months + " " + text;
126181
- }
126182
- const days = date3.diff(startDate, "days");
126183
- if (days > 0) {
126184
- let text = "days ";
126185
- if (days === 1) {
126186
- text = "day ";
126187
- }
126188
- startDate.add(days, "days");
126189
- formattedString += days + " " + text;
126190
- }
126191
- const hours = date3.diff(startDate, "hours");
126192
- if (hours > 0) {
126193
- let text = "hours ";
126194
- if (hours === 1) {
126195
- text = "hour ";
126196
- }
126197
- startDate.add(hours, "hours");
126198
- formattedString += hours + " " + text;
126199
- }
126200
- const minutes = date3.diff(startDate, "minutes");
126201
- if (minutes > 0) {
126202
- let text = "mins ";
126203
- if (minutes === 1) {
126204
- text = "min ";
126679
+ const parts = this.getFriendlyTimeParts(seconds);
126680
+ return writeInDateDisplayLanguage(
126681
+ () => {
126682
+ return parts.map((part) => {
126683
+ const names = FRIENDLY_TIME_ENGLISH_UNITS[part.unit] || [part.unit, part.unit];
126684
+ return `${part.count} ${part.count === 1 ? names[0] : names[1]}`;
126685
+ }).join(" ");
126686
+ },
126687
+ (_language, locale) => {
126688
+ return parts.length > 0 ? this.formatLocalizedDuration(parts, locale, "short", "narrow") : null;
126205
126689
  }
126206
- startDate.add(minutes, "minutes");
126207
- formattedString += minutes + " " + text;
126208
- }
126209
- const secondsLeft = date3.diff(startDate, "seconds");
126210
- if (secondsLeft > 0) {
126211
- let text = "secs ";
126212
- if (secondsLeft === 1) {
126213
- text = "sec ";
126690
+ );
126691
+ }
126692
+ // The non-zero calendar units in `seconds` from the epoch, largest first.
126693
+ static getFriendlyTimeParts(seconds) {
126694
+ const startDate = import_moment_timezone2.default.utc(0);
126695
+ const date3 = import_moment_timezone2.default.utc(seconds * 1e3);
126696
+ const parts = [];
126697
+ const units = [
126698
+ { unit: "year", moment: "years" },
126699
+ { unit: "month", moment: "months" },
126700
+ { unit: "day", moment: "days" },
126701
+ { unit: "hour", moment: "hours" },
126702
+ { unit: "minute", moment: "minutes" },
126703
+ { unit: "second", moment: "seconds" }
126704
+ ];
126705
+ for (const unit of units) {
126706
+ const count = date3.diff(startDate, unit.moment);
126707
+ if (count > 0) {
126708
+ startDate.add(count, unit.moment);
126709
+ parts.push({ count, unit: unit.unit });
126214
126710
  }
126215
- startDate.add(secondsLeft, "seconds");
126216
- formattedString += secondsLeft + " " + text;
126217
126711
  }
126218
- return formattedString.trim();
126712
+ return parts;
126219
126713
  }
126220
126714
  static getGreaterDate(a, b) {
126221
126715
  a = this.fromString(a);
@@ -126236,8 +126730,8 @@ var OneUptimeDate = class _OneUptimeDate {
126236
126730
  static getSecondsBetweenDates(start, end) {
126237
126731
  start = this.fromString(start);
126238
126732
  end = this.fromString(end);
126239
- const duration2 = import_moment_timezone.default.duration(
126240
- (0, import_moment_timezone.default)(end).diff((0, import_moment_timezone.default)(start))
126733
+ const duration2 = import_moment_timezone2.default.duration(
126734
+ (0, import_moment_timezone2.default)(end).diff((0, import_moment_timezone2.default)(start))
126241
126735
  );
126242
126736
  return duration2.asSeconds();
126243
126737
  }
@@ -126245,7 +126739,7 @@ var OneUptimeDate = class _OneUptimeDate {
126245
126739
  if (!(days instanceof PositiveNumber)) {
126246
126740
  days = new PositiveNumber(days);
126247
126741
  }
126248
- return (0, import_moment_timezone.default)(date3).add(days.toNumber(), "days").toDate();
126742
+ return (0, import_moment_timezone2.default)(date3).add(days.toNumber(), "days").toDate();
126249
126743
  }
126250
126744
  static getSomeSecondsAfter(seconds) {
126251
126745
  if (!(seconds instanceof PositiveNumber)) {
@@ -126254,37 +126748,37 @@ var OneUptimeDate = class _OneUptimeDate {
126254
126748
  return this.getCurrentMomentDate().add(seconds.toNumber(), "seconds").toDate();
126255
126749
  }
126256
126750
  static getNumberOfDaysBetweenDates(startDate, endDate) {
126257
- const a = (0, import_moment_timezone.default)(startDate);
126258
- const b = (0, import_moment_timezone.default)(endDate);
126751
+ const a = (0, import_moment_timezone2.default)(startDate);
126752
+ const b = (0, import_moment_timezone2.default)(endDate);
126259
126753
  return b.diff(a, "days");
126260
126754
  }
126261
126755
  static getNumberOfMinutesBetweenDates(startDate, endDate) {
126262
- const a = (0, import_moment_timezone.default)(startDate);
126263
- const b = (0, import_moment_timezone.default)(endDate);
126756
+ const a = (0, import_moment_timezone2.default)(startDate);
126757
+ const b = (0, import_moment_timezone2.default)(endDate);
126264
126758
  return b.diff(a, "minutes");
126265
126759
  }
126266
126760
  static getNumberOfDaysBetweenDatesInclusive(startDate, endDate) {
126267
126761
  return this.getNumberOfDaysBetweenDates(startDate, endDate) + 1;
126268
126762
  }
126269
- static momentToDate(moment2) {
126270
- return moment2.toDate();
126763
+ static momentToDate(moment3) {
126764
+ return moment3.toDate();
126271
126765
  }
126272
126766
  static getCurrentYear() {
126273
- return (0, import_moment_timezone.default)().year();
126767
+ return (0, import_moment_timezone2.default)().year();
126274
126768
  }
126275
126769
  static getStartOfDay(date3, timezone) {
126276
126770
  date3 = this.fromString(date3);
126277
126771
  if (timezone) {
126278
- return import_moment_timezone.default.tz(date3, timezone).startOf("day").toDate();
126772
+ return import_moment_timezone2.default.tz(date3, timezone).startOf("day").toDate();
126279
126773
  }
126280
- return (0, import_moment_timezone.default)(date3).startOf("day").toDate();
126774
+ return (0, import_moment_timezone2.default)(date3).startOf("day").toDate();
126281
126775
  }
126282
126776
  static getEndOfDay(date3, timezone) {
126283
126777
  date3 = this.fromString(date3);
126284
126778
  if (timezone) {
126285
- return import_moment_timezone.default.tz(date3, timezone).endOf("day").toDate();
126779
+ return import_moment_timezone2.default.tz(date3, timezone).endOf("day").toDate();
126286
126780
  }
126287
- return (0, import_moment_timezone.default)(date3).endOf("day").toDate();
126781
+ return (0, import_moment_timezone2.default)(date3).endOf("day").toDate();
126288
126782
  }
126289
126783
  /*
126290
126784
  * Calendar arithmetic - "the previous calendar month", "add 3 calendar
@@ -126304,7 +126798,7 @@ var OneUptimeDate = class _OneUptimeDate {
126304
126798
  return unit;
126305
126799
  }
126306
126800
  static inTimezone(date3, timezone) {
126307
- return timezone ? import_moment_timezone.default.tz(date3, timezone) : (0, import_moment_timezone.default)(date3);
126801
+ return timezone ? import_moment_timezone2.default.tz(date3, timezone) : (0, import_moment_timezone2.default)(date3);
126308
126802
  }
126309
126803
  /*
126310
126804
  * The instant the calendar unit containing `date` began - e.g. the first
@@ -126336,17 +126830,17 @@ var OneUptimeDate = class _OneUptimeDate {
126336
126830
  date3 = this.fromString(date3);
126337
126831
  startDate = this.fromString(startDate);
126338
126832
  endDate = this.fromString(endDate);
126339
- return (0, import_moment_timezone.default)(date3).isBetween(startDate, endDate);
126833
+ return (0, import_moment_timezone2.default)(date3).isBetween(startDate, endDate);
126340
126834
  }
126341
126835
  static isAfter(date3, startDate) {
126342
126836
  date3 = this.fromString(date3);
126343
126837
  startDate = this.fromString(startDate);
126344
- return (0, import_moment_timezone.default)(date3).isAfter(startDate, "seconds");
126838
+ return (0, import_moment_timezone2.default)(date3).isAfter(startDate, "seconds");
126345
126839
  }
126346
126840
  static isOnOrAfter(date3, startDate) {
126347
126841
  date3 = this.fromString(date3);
126348
126842
  startDate = this.fromString(startDate);
126349
- return (0, import_moment_timezone.default)(date3).isSameOrAfter(startDate, "seconds");
126843
+ return (0, import_moment_timezone2.default)(date3).isSameOrAfter(startDate, "seconds");
126350
126844
  }
126351
126845
  static getDayOfWeek(date3, timezone) {
126352
126846
  const dayOfWeek = this.geyDayOfWeekAsNumber(date3, timezone);
@@ -126370,28 +126864,28 @@ var OneUptimeDate = class _OneUptimeDate {
126370
126864
  static geyDayOfWeekAsNumber(date3, timezone) {
126371
126865
  date3 = this.fromString(date3);
126372
126866
  if (timezone) {
126373
- return import_moment_timezone.default.tz(date3, timezone).isoWeekday();
126867
+ return import_moment_timezone2.default.tz(date3, timezone).isoWeekday();
126374
126868
  }
126375
- return (0, import_moment_timezone.default)(date3).isoWeekday();
126869
+ return (0, import_moment_timezone2.default)(date3).isoWeekday();
126376
126870
  }
126377
126871
  static isOnOrBefore(date3, endDate) {
126378
126872
  date3 = this.fromString(date3);
126379
126873
  endDate = this.fromString(endDate);
126380
- return (0, import_moment_timezone.default)(date3).isSameOrBefore(endDate, "seconds");
126874
+ return (0, import_moment_timezone2.default)(date3).isSameOrBefore(endDate, "seconds");
126381
126875
  }
126382
126876
  static isEqualBySeconds(date3, startDate) {
126383
126877
  date3 = this.fromString(date3);
126384
126878
  startDate = this.fromString(startDate);
126385
- return (0, import_moment_timezone.default)(date3).isSame(startDate, "seconds");
126879
+ return (0, import_moment_timezone2.default)(date3).isSame(startDate, "seconds");
126386
126880
  }
126387
126881
  static hasExpired(expirationDate) {
126388
126882
  expirationDate = this.fromString(expirationDate);
126389
- return !(0, import_moment_timezone.default)(this.getCurrentDate()).isBefore(expirationDate, "seconds");
126883
+ return !(0, import_moment_timezone2.default)(this.getCurrentDate()).isBefore(expirationDate, "seconds");
126390
126884
  }
126391
126885
  static isBefore(date3, endDate) {
126392
126886
  date3 = this.fromString(date3);
126393
126887
  endDate = this.fromString(endDate);
126394
- return (0, import_moment_timezone.default)(date3).isBefore(endDate, "seconds");
126888
+ return (0, import_moment_timezone2.default)(date3).isBefore(endDate, "seconds");
126395
126889
  }
126396
126890
  static getCurrentDateAsFormattedString(options) {
126397
126891
  return this.getDateAsFormattedString(/* @__PURE__ */ new Date(), options);
@@ -126463,12 +126957,35 @@ var OneUptimeDate = class _OneUptimeDate {
126463
126957
  if (options?.onlyShowDate) {
126464
126958
  formatstring = "MMM DD, YYYY";
126465
126959
  }
126466
- return (0, import_moment_timezone.default)(date3).format(formatstring) + " " + (options?.onlyShowDate ? "" : this.getCurrentTimezoneString());
126960
+ const instant = date3;
126961
+ return writeInDateDisplayLanguage(
126962
+ () => {
126963
+ return (0, import_moment_timezone2.default)(instant).format(formatstring) + " " + (options?.onlyShowDate ? "" : this.getCurrentTimezoneString());
126964
+ },
126965
+ (language, locale) => {
126966
+ const text = this.getLocalizedDateText({
126967
+ date: instant,
126968
+ language,
126969
+ locale,
126970
+ shape: {
126971
+ onlyShowDate: options?.onlyShowDate,
126972
+ showSeconds: options?.showSeconds,
126973
+ use12HourFormat: options?.use12HourFormat,
126974
+ twoDigitDay: true
126975
+ },
126976
+ timezones: []
126977
+ });
126978
+ if (!text || options?.onlyShowDate) {
126979
+ return text;
126980
+ }
126981
+ return `${text} ${this.getCurrentTimezoneString()}`.trim();
126982
+ }
126983
+ );
126467
126984
  }
126468
126985
  static getDifferenceInMinutes(date3, date22) {
126469
126986
  date3 = this.fromString(date3);
126470
126987
  date22 = this.fromString(date22);
126471
- const minutes = (0, import_moment_timezone.default)(date3).diff((0, import_moment_timezone.default)(date22), "minutes");
126988
+ const minutes = (0, import_moment_timezone2.default)(date3).diff((0, import_moment_timezone2.default)(date22), "minutes");
126472
126989
  if (minutes < 0) {
126473
126990
  return minutes * -1;
126474
126991
  }
@@ -126477,7 +126994,7 @@ var OneUptimeDate = class _OneUptimeDate {
126477
126994
  static getDifferenceInSeconds(date3, date22) {
126478
126995
  date3 = this.fromString(date3);
126479
126996
  date22 = this.fromString(date22);
126480
- const seconds = (0, import_moment_timezone.default)(date3).diff((0, import_moment_timezone.default)(date22), "seconds");
126997
+ const seconds = (0, import_moment_timezone2.default)(date3).diff((0, import_moment_timezone2.default)(date22), "seconds");
126481
126998
  if (seconds < 0) {
126482
126999
  return seconds * -1;
126483
127000
  }
@@ -126486,7 +127003,7 @@ var OneUptimeDate = class _OneUptimeDate {
126486
127003
  static getDifferenceInMonths(date3, date22) {
126487
127004
  date3 = this.fromString(date3);
126488
127005
  date22 = this.fromString(date22);
126489
- const months = (0, import_moment_timezone.default)(date3).diff((0, import_moment_timezone.default)(date22), "months");
127006
+ const months = (0, import_moment_timezone2.default)(date3).diff((0, import_moment_timezone2.default)(date22), "months");
126490
127007
  if (months < 0) {
126491
127008
  return months * -1;
126492
127009
  }
@@ -126497,6 +127014,31 @@ var OneUptimeDate = class _OneUptimeDate {
126497
127014
  const hours = Math.floor(seconds % (24 * 60 * 60) / (60 * 60));
126498
127015
  const minutes = Math.floor(seconds % (60 * 60) / 60);
126499
127016
  const secs = seconds % 60;
127017
+ return writeInDateDisplayLanguage(
127018
+ () => {
127019
+ return this.getEnglishDaysHoursMinutesAndSeconds({
127020
+ days,
127021
+ hours,
127022
+ minutes,
127023
+ secs
127024
+ });
127025
+ },
127026
+ (_language, locale) => {
127027
+ const parts = [
127028
+ { count: days, unit: "day" },
127029
+ { count: hours, unit: "hour" },
127030
+ { count: minutes, unit: "minute" },
127031
+ { count: secs, unit: "second" }
127032
+ ].filter((part) => {
127033
+ return part.count > 0;
127034
+ });
127035
+ return parts.length > 0 ? this.formatLocalizedDuration(parts, locale, "long", "long") : null;
127036
+ }
127037
+ );
127038
+ }
127039
+ // convertSecondsToDaysHoursMinutesAndSeconds's English, word for word.
127040
+ static getEnglishDaysHoursMinutesAndSeconds(data) {
127041
+ const { days, hours, minutes, secs } = data;
126500
127042
  let formattedString = "";
126501
127043
  if (days > 0) {
126502
127044
  formattedString += days + " days";
@@ -126525,6 +127067,27 @@ var OneUptimeDate = class _OneUptimeDate {
126525
127067
  const days = Math.floor(minutes / (24 * 60));
126526
127068
  const hours = Math.floor(minutes % (24 * 60) / 60);
126527
127069
  const mins = minutes % 60;
127070
+ return writeInDateDisplayLanguage(
127071
+ () => {
127072
+ return this.getEnglishDaysHoursAndMinutes({ days, hours, mins });
127073
+ },
127074
+ (_language, locale) => {
127075
+ const parts = [
127076
+ { count: days, unit: "day" },
127077
+ { count: hours, unit: "hour" }
127078
+ ].filter((part) => {
127079
+ return part.count > 0;
127080
+ });
127081
+ if (mins >= 0) {
127082
+ parts.push({ count: mins, unit: "minute" });
127083
+ }
127084
+ return this.formatLocalizedDuration(parts, locale, "long", "long");
127085
+ }
127086
+ );
127087
+ }
127088
+ // convertMinutesToDaysHoursAndMinutes's English, word for word.
127089
+ static getEnglishDaysHoursAndMinutes(data) {
127090
+ const { days, hours, mins } = data;
126528
127091
  let formattedString = "";
126529
127092
  if (days > 0) {
126530
127093
  formattedString += days + " days";
@@ -126543,7 +127106,32 @@ var OneUptimeDate = class _OneUptimeDate {
126543
127106
  }
126544
127107
  return formattedString;
126545
127108
  }
127109
+ /*
127110
+ * "1.72 s", "960 ms", "2h 5m". The unit symbols read the same in every
127111
+ * language, as a unit symbol does; the figure is written the reader's
127112
+ * way - "1,72 s" in German.
127113
+ */
126546
127114
  static getHumanizedDurationFromNanoseconds(data) {
127115
+ const english = this.getEnglishHumanizedDuration(data);
127116
+ return writeInDateDisplayLanguage(
127117
+ () => {
127118
+ return english;
127119
+ },
127120
+ (_language, locale) => {
127121
+ return this.withDecimalSeparatorOf(english, locale);
127122
+ }
127123
+ );
127124
+ }
127125
+ // `text`'s decimal points as `locale` writes them: "1.72 s" -> "1,72 s".
127126
+ static withDecimalSeparatorOf(text, locale) {
127127
+ const separator = (formatDecimal({ value: 1.5, locale, maximumFractionDigits: 1 }) || "1.5").replace(DIGITS, "");
127128
+ if (!separator || separator === ".") {
127129
+ return text;
127130
+ }
127131
+ return text.replace(DURATION_DECIMAL_POINT, `$1${separator}$2`);
127132
+ }
127133
+ // getHumanizedDurationFromNanoseconds's English, as it always read.
127134
+ static getEnglishHumanizedDuration(data) {
126547
127135
  let { nanoseconds } = data;
126548
127136
  const maxParts = data.maxParts ?? 2;
126549
127137
  if (!Number.isFinite(nanoseconds)) {
@@ -126624,14 +127212,14 @@ var OneUptimeDate = class _OneUptimeDate {
126624
127212
  return fixed.replace(/\.0+$/, "").replace(/(\.\d*?[1-9])0+$/, "$1");
126625
127213
  }
126626
127214
  static getGmtOffsetByTimezone(timezone) {
126627
- return import_moment_timezone.default.tz(timezone).utcOffset();
127215
+ return import_moment_timezone2.default.tz(timezone).utcOffset();
126628
127216
  }
126629
127217
  static getGmtOffsetFriendlyStringByTimezone(timezone) {
126630
127218
  const offset = this.getGmtOffsetByTimezone(timezone);
126631
127219
  return this.getGmtOffsetFriendlyString(offset) + " " + timezone;
126632
127220
  }
126633
127221
  static isValidDateString(date3) {
126634
- return (0, import_moment_timezone.default)(date3).isValid();
127222
+ return (0, import_moment_timezone2.default)(date3).isValid();
126635
127223
  }
126636
127224
  static getGmtOffsetFriendlyString(offset) {
126637
127225
  const hours = Math.abs(offset) / 60;
@@ -126672,9 +127260,32 @@ var OneUptimeDate = class _OneUptimeDate {
126672
127260
  Timezone_default.AustraliaSydney
126673
127261
  ];
126674
127262
  }
127263
+ const instant = date3;
126675
127264
  for (let i = 0; i < timezones.length; i++) {
127265
+ const timezone = timezones[i];
126676
127266
  timezoneDates.push(
126677
- (0, import_moment_timezone.default)(date3).tz(timezones[i]).format(formatstring) + " " + (onlyShowDate ? "" : this.getZoneAbbrByTimezone(timezones[i], date3))
127267
+ writeInDateDisplayLanguage(
127268
+ () => {
127269
+ return (0, import_moment_timezone2.default)(instant).tz(timezone.toString()).format(formatstring) + " " + (onlyShowDate ? "" : this.getZoneAbbrByTimezone(timezone, instant));
127270
+ },
127271
+ (language, locale) => {
127272
+ const text = this.getLocalizedDateText({
127273
+ date: instant,
127274
+ language,
127275
+ locale,
127276
+ shape: {
127277
+ onlyShowDate,
127278
+ use12HourFormat,
127279
+ twoDigitDay: true
127280
+ },
127281
+ timezones: this.getTimezoneNames(timezone)
127282
+ });
127283
+ if (!text || onlyShowDate) {
127284
+ return text;
127285
+ }
127286
+ return `${text} ${this.getZoneAbbrByTimezone(timezone, instant)}`;
127287
+ }
127288
+ )
126678
127289
  );
126679
127290
  }
126680
127291
  return timezoneDates;
@@ -126719,9 +127330,28 @@ var OneUptimeDate = class _OneUptimeDate {
126719
127330
  if (onlyShowDate) {
126720
127331
  formatstring = "MMM DD, YYYY";
126721
127332
  }
126722
- const momentDate = this.inCurrentTimezone(date3);
126723
- const zoneAbbr = onlyShowDate ? "" : this.getZoneAbbrByTimezone(this.getCurrentTimezone(), date3);
126724
- return (momentDate.format(formatstring) + " " + zoneAbbr).trim();
127333
+ const instant = date3;
127334
+ const zoneAbbr = onlyShowDate ? "" : this.getZoneAbbrByTimezone(this.getCurrentTimezone(), instant);
127335
+ return writeInDateDisplayLanguage(
127336
+ () => {
127337
+ const momentDate = this.inCurrentTimezone(instant);
127338
+ return (momentDate.format(formatstring) + " " + zoneAbbr).trim();
127339
+ },
127340
+ (language, locale) => {
127341
+ const text = this.getLocalizedDateText({
127342
+ date: instant,
127343
+ language,
127344
+ locale,
127345
+ shape: {
127346
+ onlyShowDate,
127347
+ showSeconds,
127348
+ use12HourFormat,
127349
+ twoDigitDay: true
127350
+ }
127351
+ });
127352
+ return text ? `${text} ${zoneAbbr}`.trim() : null;
127353
+ }
127354
+ );
126725
127355
  }
126726
127356
  static getDayInSeconds(days) {
126727
127357
  if (!days) {
@@ -126733,7 +127363,7 @@ var OneUptimeDate = class _OneUptimeDate {
126733
127363
  return this.getZoneAbbrByTimezone(this.getCurrentTimezone());
126734
127364
  }
126735
127365
  static getZoneAbbrByTimezone(timezone, date3) {
126736
- let zoneAbbr = date3 ? (0, import_moment_timezone.default)(this.fromString(date3)).tz(timezone).zoneAbbr() : import_moment_timezone.default.tz(timezone).zoneAbbr();
127366
+ let zoneAbbr = date3 ? (0, import_moment_timezone2.default)(this.fromString(date3)).tz(timezone).zoneAbbr() : import_moment_timezone2.default.tz(timezone).zoneAbbr();
126737
127367
  if (zoneAbbr.startsWith("+") || zoneAbbr.startsWith("-")) {
126738
127368
  zoneAbbr = "GMT" + zoneAbbr;
126739
127369
  }
@@ -126757,7 +127387,7 @@ var OneUptimeDate = class _OneUptimeDate {
126757
127387
  return;
126758
127388
  }
126759
127389
  const currentTimezone = TimezoneAlias.getCanonicalTimezone(timezone);
126760
- if (!import_moment_timezone.default.tz.zone(currentTimezone.toString())) {
127390
+ if (!import_moment_timezone2.default.tz.zone(currentTimezone.toString())) {
126761
127391
  this.userTimezone = null;
126762
127392
  return;
126763
127393
  }
@@ -126776,14 +127406,14 @@ var OneUptimeDate = class _OneUptimeDate {
126776
127406
  * moment caches its guess, and the translation is a map read.
126777
127407
  */
126778
127408
  static getCurrentTimezone() {
126779
- return this.userTimezone || TimezoneAlias.getCanonicalTimezone(import_moment_timezone.default.tz.guess());
127409
+ return this.userTimezone || TimezoneAlias.getCanonicalTimezone(import_moment_timezone2.default.tz.guess());
126780
127410
  }
126781
127411
  /**
126782
127412
  * The instant `date` viewed through the current timezone — the single place
126783
127413
  * that decides which wall clock the "local" helpers below read from.
126784
127414
  */
126785
127415
  static inCurrentTimezone(date3) {
126786
- return (0, import_moment_timezone.default)(this.fromString(date3)).tz(this.getCurrentTimezone());
127416
+ return (0, import_moment_timezone2.default)(this.fromString(date3)).tz(this.getCurrentTimezone());
126787
127417
  }
126788
127418
  static getDateString(date3) {
126789
127419
  date3 = this.fromString(date3);
@@ -126791,11 +127421,11 @@ var OneUptimeDate = class _OneUptimeDate {
126791
127421
  }
126792
127422
  static isInThePast(date3) {
126793
127423
  date3 = this.fromString(date3);
126794
- return (0, import_moment_timezone.default)(date3).isBefore(/* @__PURE__ */ new Date(), "seconds");
127424
+ return (0, import_moment_timezone2.default)(date3).isBefore(/* @__PURE__ */ new Date(), "seconds");
126795
127425
  }
126796
127426
  static isInTheFuture(date3) {
126797
127427
  date3 = this.fromString(date3);
126798
- return (0, import_moment_timezone.default)(date3).isAfter(/* @__PURE__ */ new Date(), "seconds");
127428
+ return (0, import_moment_timezone2.default)(date3).isAfter(/* @__PURE__ */ new Date(), "seconds");
126799
127429
  }
126800
127430
  static fromString(date3) {
126801
127431
  if (date3 instanceof Date) {
@@ -126804,16 +127434,16 @@ var OneUptimeDate = class _OneUptimeDate {
126804
127434
  if (typeof date3 === "string") {
126805
127435
  const trimmedDate = date3.trim();
126806
127436
  if (this.isUtcDateTimeString(trimmedDate)) {
126807
- return import_moment_timezone.default.utc(this.normalizeUtcDateTimeString(trimmedDate)).toDate();
127437
+ return import_moment_timezone2.default.utc(this.normalizeUtcDateTimeString(trimmedDate)).toDate();
126808
127438
  }
126809
127439
  try {
126810
- return (0, import_moment_timezone.default)(trimmedDate).toDate();
127440
+ return (0, import_moment_timezone2.default)(trimmedDate).toDate();
126811
127441
  } catch {
126812
127442
  return new Date(trimmedDate);
126813
127443
  }
126814
127444
  }
126815
127445
  if (date3 && date3["value"] && typeof date3["value"] === "string" && date3["_type"] && (date3["_type"] === "Date" || date3["_type"] === "DateTime")) {
126816
- return (0, import_moment_timezone.default)(date3["value"]).toDate();
127446
+ return (0, import_moment_timezone2.default)(date3["value"]).toDate();
126817
127447
  }
126818
127448
  throw new BadDataException(
126819
127449
  "Invalid date: " + refusedValue(date3?.toString())
@@ -126825,7 +127455,7 @@ var OneUptimeDate = class _OneUptimeDate {
126825
127455
  }
126826
127456
  static asFilterDateForDatabaseQuery(date3) {
126827
127457
  date3 = this.fromString(date3);
126828
- const formattedDate = (0, import_moment_timezone.default)(date3).toDate();
127458
+ const formattedDate = (0, import_moment_timezone2.default)(date3).toDate();
126829
127459
  return new InBetween(
126830
127460
  _OneUptimeDate.getStartOfDay(formattedDate),
126831
127461
  _OneUptimeDate.getEndOfDay(formattedDate)
@@ -126853,7 +127483,7 @@ var OneUptimeDate = class _OneUptimeDate {
126853
127483
  }
126854
127484
  static toDatabaseDate(date3) {
126855
127485
  date3 = this.fromString(date3);
126856
- return (0, import_moment_timezone.default)(date3).format("YYYY-MM-DD HH:mm:ss");
127486
+ return (0, import_moment_timezone2.default)(date3).format("YYYY-MM-DD HH:mm:ss");
126857
127487
  }
126858
127488
  static resetSecondsAndMilliseconds(date3) {
126859
127489
  date3 = this.fromString(date3);
@@ -329928,6 +330558,7 @@ var CodeRepository = class extends DatabaseBaseModel {
329928
330558
  this.testCommand = void 0;
329929
330559
  this.runner = void 0;
329930
330560
  this.runnerId = void 0;
330561
+ this.isGlobalRunnerPicked = void 0;
329931
330562
  this.maxOpenFixPullRequests = void 0;
329932
330563
  this.isGitHubCommandsEnabled = void 0;
329933
330564
  this.gitHubTriggerLabel = void 0;
@@ -330453,7 +331084,7 @@ __decorateClass([
330453
331084
  type: TableColumnType_default.Entity,
330454
331085
  modelType: Runner,
330455
331086
  title: "Runner",
330456
- description: "The Runner AI works in this repository on. Empty means a global Runner, one OneUptime runs for every project."
331087
+ description: "The Runner AI works in this repository on. Empty means the project's default Runner when it has one, and otherwise a global Runner, one OneUptime runs for every project."
330457
331088
  }),
330458
331089
  ManyToOne(
330459
331090
  () => {
@@ -330503,7 +331134,7 @@ __decorateClass([
330503
331134
  required: false,
330504
331135
  canReadOnRelationQuery: true,
330505
331136
  title: "Runner ID",
330506
- description: "ID of the Runner AI works in this repository on: one of the project's own Runners. Empty means a global Runner, one OneUptime runs for every project."
331137
+ description: "ID of the Runner AI works in this repository on: one of the project's own Runners. Empty means the project's default Runner when it has one, and otherwise a global Runner, one OneUptime runs for every project."
330507
331138
  }),
330508
331139
  Column({
330509
331140
  type: ColumnType_default.ObjectID,
@@ -330511,6 +331142,47 @@ __decorateClass([
330511
331142
  transformer: ObjectID.getDatabaseTransformer()
330512
331143
  })
330513
331144
  ], CodeRepository.prototype, "runnerId", 2);
331145
+ __decorateClass([
331146
+ ColumnAccessControl_default({
331147
+ create: [
331148
+ Permission_default.ProjectOwner,
331149
+ Permission_default.ProjectAdmin,
331150
+ Permission_default.ProjectMember,
331151
+ Permission_default.SettingsAdmin,
331152
+ Permission_default.SettingsMember,
331153
+ Permission_default.CreateCodeRepository
331154
+ ],
331155
+ read: [
331156
+ Permission_default.ProjectOwner,
331157
+ Permission_default.ProjectAdmin,
331158
+ Permission_default.ProjectMember,
331159
+ Permission_default.Viewer,
331160
+ Permission_default.SettingsAdmin,
331161
+ Permission_default.SettingsMember,
331162
+ Permission_default.SettingsViewer,
331163
+ Permission_default.ReadCodeRepository
331164
+ ],
331165
+ update: [
331166
+ Permission_default.ProjectOwner,
331167
+ Permission_default.ProjectAdmin,
331168
+ Permission_default.ProjectMember,
331169
+ Permission_default.SettingsAdmin,
331170
+ Permission_default.SettingsMember,
331171
+ Permission_default.EditCodeRepository
331172
+ ]
331173
+ }),
331174
+ TableColumn_default({
331175
+ required: false,
331176
+ type: TableColumnType_default.Boolean,
331177
+ title: "Picks Global Runner",
331178
+ description: "Whether this repository runs on a global Runner, one OneUptime runs for every project, even when the project has a default Runner. Read only when the repository picks no Runner of its own. Unset, a repository that picks no Runner follows the project's default Runner, and runs on a global Runner while there is none.",
331179
+ example: true
331180
+ }),
331181
+ Column({
331182
+ nullable: true,
331183
+ type: ColumnType_default.Boolean
331184
+ })
331185
+ ], CodeRepository.prototype, "isGlobalRunnerPicked", 2);
330514
331186
  __decorateClass([
330515
331187
  ColumnAccessControl_default({
330516
331188
  create: [
@@ -389070,7 +389742,7 @@ AutoRemediationRule = __decorateClass([
389070
389742
  // Terraform's oneuptime_auto_remediation_rule keeps working, deprecated.
389071
389743
  formerSingularName: "Auto Remediation Rule",
389072
389744
  icon: IconProp_default.Sparkles,
389073
- tableDescription: "Which new incidents or alerts OneUptime AI investigates and fixes, and how. A rule investigates what it matches (right away, or only if still open after a wait), and fixes it or not, asking first or not. A fix may run the project's runbooks (only the rule's, when it names some), Bash commands on a Runner the rule picks, the tools of the project's external MCP servers (only the rule's, when it names some), and open fix and telemetry pull requests in the project's code repositories (only the rule's, when it names some). With no rule, OneUptime AI investigates every one, and fixes every one while automatic fixing is on. These were auto remediation rules, and investigation rules are AI rules now too. A rule whose Trigger Entity Type is Profile decides the same about the slow code OneUptime finds in a service's profiles, one whose Trigger Entity Type is Trace about the slow and failing operations OneUptime finds in a service's traces, and one whose Trigger Entity Type is Metric about the problems OneUptime finds in a service's metrics, matched by their service; their fix is a pull request in one of the project's code repositories."
389745
+ tableDescription: "Which new incidents or alerts OneUptime AI investigates and fixes, and how. A rule investigates what it matches (right away, or only if still open after a wait), and fixes it or not, asking first or not. A fix may run the project's runbooks (only the rule's, when it names some), Bash commands on a Runner the rule picks, the tools of the project's external MCP servers (only the rule's, when it names some), and open fix and telemetry pull requests in the project's code repositories (only the rule's, when it names some). With no rule, OneUptime AI investigates every one, and fixes every one while automatic fixing is on. These were auto remediation rules, and investigation rules are AI rules now too. A rule whose Trigger Entity Type is Profile, Trace, Exception, Log or Metric decides the same about the problems OneUptime finds in a service's profiles, traces, exceptions, logs or metrics, matched by their service; their fix is a pull request in one of the project's code repositories."
389074
389746
  })
389075
389747
  ], AutoRemediationRule);
389076
389748