@timardex/cluemart-shared 2.5.1 → 3.0.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.
@@ -1,18 +1,18 @@
1
- import "../chunk-CQ26N3W6.mjs";
1
+ import "../chunk-OVSUNBMA.mjs";
2
2
  import "../chunk-VA5YN2K3.mjs";
3
3
  import "../chunk-VPANTTZI.mjs";
4
4
  import "../chunk-DWO35OY4.mjs";
5
- import "../chunk-H6HM2FOZ.mjs";
5
+ import "../chunk-FVUZ5SPE.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-NEOBS55J.mjs";
10
+ } from "../chunk-XXHTG4GJ.mjs";
11
11
  import "../chunk-RE4NZPYY.mjs";
12
12
  import {
13
13
  dateFormat,
14
14
  timeFormat
15
- } from "../chunk-4CQLKIQ6.mjs";
15
+ } from "../chunk-ENRGEWZM.mjs";
16
16
  import {
17
17
  EnumAdShowOn,
18
18
  EnumAdStatus,
package/dist/index.cjs CHANGED
@@ -245,6 +245,7 @@ __export(index_exports, {
245
245
  foodFlavourOptions: () => foodFlavourOptions,
246
246
  formatCategoryLabel: () => formatCategoryLabel,
247
247
  formatDate: () => formatDate,
248
+ formatDateOptionLabel: () => formatDateOptionLabel,
248
249
  formatDistance: () => formatDistance,
249
250
  formatIrdNumber: () => formatIrdNumber,
250
251
  formatNZBankAccount: () => formatNZBankAccount,
@@ -1345,6 +1346,14 @@ var formatDate = (dateStr, display = "datetime", timeStr) => {
1345
1346
  return formattedDate;
1346
1347
  }
1347
1348
  };
1349
+ function formatDateOptionLabel(dateStr) {
1350
+ const parsed = (0, import_dayjs2.default)(dateStr, dateFormat, true);
1351
+ if (!parsed.isValid()) {
1352
+ return dateStr;
1353
+ }
1354
+ const label = formatDate(dateStr, "date");
1355
+ return parsed.isBefore((0, import_dayjs2.default)(), "day") ? `${label} (Past)` : label;
1356
+ }
1348
1357
  var SLOT_FORMATS = [
1349
1358
  `${dateFormat} ${timeFormat}`,
1350
1359
  `${dateFormat} H:mm`,
@@ -3591,7 +3600,7 @@ function getEventStallholdersData({
3591
3600
  registeredForEvent,
3592
3601
  unregisteredForEvent
3593
3602
  ).map((startDate) => ({
3594
- label: formatDate(startDate, "date"),
3603
+ label: formatDateOptionLabel(startDate),
3595
3604
  value: startDate
3596
3605
  }));
3597
3606
  const hasDatePills = futureEventStartDates.length > 0;
@@ -3619,7 +3628,7 @@ function getVendorEventsData({
3619
3628
  const eventDateOptions = getVendorEventRelationDateOptions(events).map(
3620
3629
  (option) => ({
3621
3630
  ...option,
3622
- label: formatDate(option.value, "date")
3631
+ label: formatDateOptionLabel(option.value)
3623
3632
  })
3624
3633
  );
3625
3634
  return {
@@ -10786,6 +10795,7 @@ function canAccessAdminPath(roles, pathname) {
10786
10795
  foodFlavourOptions,
10787
10796
  formatCategoryLabel,
10788
10797
  formatDate,
10798
+ formatDateOptionLabel,
10789
10799
  formatDistance,
10790
10800
  formatIrdNumber,
10791
10801
  formatNZBankAccount,