@timardex/cluemart-shared 1.5.503 → 1.5.505

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.
@@ -1,4 +1,4 @@
1
- import "../chunk-KEUG6IHV.mjs";
1
+ import "../chunk-UA64PDR4.mjs";
2
2
  import "../chunk-RQDZX76B.mjs";
3
3
  import "../chunk-DWO35OY4.mjs";
4
4
  import "../chunk-I7WE3EBR.mjs";
@@ -14,7 +14,7 @@ import {
14
14
  dateFormat,
15
15
  normalizeUrl,
16
16
  timeFormat
17
- } from "../chunk-P7FGPPWG.mjs";
17
+ } from "../chunk-VJIFUOVU.mjs";
18
18
  import {
19
19
  EnumEventDateStatus,
20
20
  EnumEventType,
package/dist/index.cjs CHANGED
@@ -102,6 +102,7 @@ __export(index_exports, {
102
102
  getCurrentAndFutureDates: () => getCurrentAndFutureDates,
103
103
  globalDefaultValues: () => globalDefaultValues,
104
104
  isFutureDatesBeforeThreshold: () => isFutureDatesBeforeThreshold,
105
+ isIsoDateString: () => isIsoDateString,
105
106
  licenseNiceNames: () => licenseNiceNames,
106
107
  lightColors: () => lightColors,
107
108
  loginFields: () => loginFields,
@@ -913,7 +914,7 @@ function computeDailyClueState(dailyClue) {
913
914
  };
914
915
  }
915
916
 
916
- // src/utils/index.ts
917
+ // src/utils/date.ts
917
918
  var import_dayjs2 = __toESM(require("dayjs"));
918
919
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
919
920
  var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter.js"));
@@ -927,7 +928,7 @@ import_dayjs2.default.extend(import_timezone.default);
927
928
  import_dayjs2.default.extend(import_isSameOrAfter.default);
928
929
  var NZ_TZ = "Pacific/Auckland";
929
930
  function toNZTime(date3) {
930
- return (0, import_dayjs2.default)(date3).tz(NZ_TZ).format();
931
+ return date3 ? (0, import_dayjs2.default)(date3).tz(NZ_TZ) : (0, import_dayjs2.default)().tz(NZ_TZ);
931
932
  }
932
933
  var formatDate = (dateStr, display = "datetime", timeStr) => {
933
934
  const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
@@ -964,12 +965,25 @@ var isFutureDatesBeforeThreshold = (date3, minHoursFromNow) => {
964
965
  return dateTime.isSameOrAfter(threshold);
965
966
  };
966
967
  var formatTimestamp = (timestamp) => {
967
- const formattedDate = (0, import_dayjs2.default)(timestamp).tz("Pacific/Auckland").format(dateFormat);
968
+ const formattedDate = toNZTime(timestamp).format(dateFormat);
968
969
  return formatDate(formattedDate, "date");
969
970
  };
970
971
  var isIsoDateString = (value) => {
971
972
  return typeof value === "string" && !isNaN(Date.parse(value));
972
973
  };
974
+ function sortDatesChronologically(dates) {
975
+ if (!dates || !dates.length) {
976
+ return [];
977
+ }
978
+ return [...dates].sort((a, b) => {
979
+ const dateTimeFormat = `${dateFormat} ${timeFormat}`;
980
+ const dateA = (0, import_dayjs2.default)(`${a.startDate} ${a.startTime}`, dateTimeFormat);
981
+ const dateB = (0, import_dayjs2.default)(`${b.startDate} ${b.startTime}`, dateTimeFormat);
982
+ return dateA.valueOf() - dateB.valueOf();
983
+ });
984
+ }
985
+
986
+ // src/utils/utils.ts
973
987
  var removeTypename = (obj) => {
974
988
  if (obj instanceof Date) {
975
989
  return obj;
@@ -1009,17 +1023,6 @@ var statusOptions = [
1009
1023
  })).sort((a, b) => a.label.localeCompare(b.label))
1010
1024
  // Sort the options alphabetically
1011
1025
  ];
1012
- function sortDatesChronologically(dates) {
1013
- if (!dates || !dates.length) {
1014
- return [];
1015
- }
1016
- return [...dates].sort((a, b) => {
1017
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
1018
- const dateA = (0, import_dayjs2.default)(`${a.startDate} ${a.startTime}`, dateTimeFormat);
1019
- const dateB = (0, import_dayjs2.default)(`${b.startDate} ${b.startTime}`, dateTimeFormat);
1020
- return dateA.valueOf() - dateB.valueOf();
1021
- });
1022
- }
1023
1026
  var availableRegionTypes = Object.values(EnumRegions);
1024
1027
  var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
1025
1028
  var paymentMethodOptions = mapArrayToOptions(
@@ -8289,6 +8292,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8289
8292
  getCurrentAndFutureDates,
8290
8293
  globalDefaultValues,
8291
8294
  isFutureDatesBeforeThreshold,
8295
+ isIsoDateString,
8292
8296
  licenseNiceNames,
8293
8297
  lightColors,
8294
8298
  loginFields,