@timardex/cluemart-shared 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NEOBS55J.mjs → chunk-T736WX7J.mjs} +5 -5
- package/dist/{chunk-NEOBS55J.mjs.map → chunk-T736WX7J.mjs.map} +1 -1
- package/dist/{chunk-4CQLKIQ6.mjs → chunk-TGEYOSSX.mjs} +24 -2
- package/dist/chunk-TGEYOSSX.mjs.map +1 -0
- package/dist/{chunk-H6HM2FOZ.mjs → chunk-WRYRBSRZ.mjs} +2 -2
- package/dist/{chunk-CQ26N3W6.mjs → chunk-YJJUTHBX.mjs} +2 -2
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.mjs +3 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +4 -4
- package/dist/index.cjs +27 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.mjs +25 -3
- package/dist/index.mjs.map +1 -1
- package/dist/sharing/index.cjs +2 -1
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.mjs +2 -2
- package/dist/utils/index.cjs +27 -3
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +17 -1
- package/dist/utils/index.d.ts +17 -1
- package/dist/utils/index.mjs +6 -2
- package/package.json +1 -1
- package/dist/chunk-4CQLKIQ6.mjs.map +0 -1
- /package/dist/{chunk-H6HM2FOZ.mjs.map → chunk-WRYRBSRZ.mjs.map} +0 -0
- /package/dist/{chunk-CQ26N3W6.mjs.map → chunk-YJJUTHBX.mjs.map} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-YJJUTHBX.mjs";
|
|
2
2
|
import "../chunk-VA5YN2K3.mjs";
|
|
3
3
|
import "../chunk-VPANTTZI.mjs";
|
|
4
4
|
import "../chunk-DWO35OY4.mjs";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-WRYRBSRZ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
8
8
|
isValidIrdNumber,
|
|
9
9
|
normalizeUrl
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-T736WX7J.mjs";
|
|
11
11
|
import "../chunk-RE4NZPYY.mjs";
|
|
12
12
|
import {
|
|
13
13
|
dateFormat,
|
|
14
14
|
timeFormat
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-TGEYOSSX.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,
|
|
@@ -313,6 +314,7 @@ __export(index_exports, {
|
|
|
313
314
|
isInternalErrorMessage: () => isInternalErrorMessage,
|
|
314
315
|
isIsoDateString: () => isIsoDateString,
|
|
315
316
|
isNonVisitorResourceType: () => isNonVisitorResourceType,
|
|
317
|
+
isPastDate: () => isPastDate,
|
|
316
318
|
isPostShareResourceType: () => isPostShareResourceType,
|
|
317
319
|
isRelationShareResourceType: () => isRelationShareResourceType,
|
|
318
320
|
isResourceImageActive: () => isResourceImageActive,
|
|
@@ -1329,10 +1331,11 @@ function nzDayKey(input) {
|
|
|
1329
1331
|
function isUtcMidnight(value) {
|
|
1330
1332
|
return value instanceof Date && !Number.isNaN(value.getTime()) && value.getUTCHours() === 0 && value.getUTCMinutes() === 0 && value.getUTCSeconds() === 0 && value.getUTCMilliseconds() === 0;
|
|
1331
1333
|
}
|
|
1334
|
+
var DATE_DISPLAY_FORMAT = "dddd, D MMMM, YYYY";
|
|
1332
1335
|
var formatDate = (dateStr, display = "datetime", timeStr) => {
|
|
1333
1336
|
const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
|
|
1334
1337
|
const dateTime = timeStr ? (0, import_dayjs2.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs2.default)(dateStr, dateFormat);
|
|
1335
|
-
const formattedDate = dateTime.format(
|
|
1338
|
+
const formattedDate = dateTime.format(DATE_DISPLAY_FORMAT);
|
|
1336
1339
|
const formattedTime = dateTime.format("h:mm a");
|
|
1337
1340
|
switch (display) {
|
|
1338
1341
|
case "date":
|
|
@@ -1345,6 +1348,25 @@ var formatDate = (dateStr, display = "datetime", timeStr) => {
|
|
|
1345
1348
|
return formattedDate;
|
|
1346
1349
|
}
|
|
1347
1350
|
};
|
|
1351
|
+
function parseStrictDate(dateStr) {
|
|
1352
|
+
return (0, import_dayjs2.default)(dateStr, dateFormat, true);
|
|
1353
|
+
}
|
|
1354
|
+
function isDayBeforeNzToday(parsed) {
|
|
1355
|
+
const dayKey = /* @__PURE__ */ new Date(`${parsed.format(isoDateFormat)}T00:00:00Z`);
|
|
1356
|
+
return dayKey.getTime() < nzDayKey().getTime();
|
|
1357
|
+
}
|
|
1358
|
+
function isPastDate(dateStr) {
|
|
1359
|
+
const parsed = parseStrictDate(dateStr);
|
|
1360
|
+
return parsed.isValid() && isDayBeforeNzToday(parsed);
|
|
1361
|
+
}
|
|
1362
|
+
function formatDateOptionLabel(dateStr) {
|
|
1363
|
+
const parsed = parseStrictDate(dateStr);
|
|
1364
|
+
if (!parsed.isValid()) {
|
|
1365
|
+
return dateStr;
|
|
1366
|
+
}
|
|
1367
|
+
const label = parsed.format(DATE_DISPLAY_FORMAT);
|
|
1368
|
+
return isDayBeforeNzToday(parsed) ? `${label} (Past)` : label;
|
|
1369
|
+
}
|
|
1348
1370
|
var SLOT_FORMATS = [
|
|
1349
1371
|
`${dateFormat} ${timeFormat}`,
|
|
1350
1372
|
`${dateFormat} H:mm`,
|
|
@@ -3591,7 +3613,7 @@ function getEventStallholdersData({
|
|
|
3591
3613
|
registeredForEvent,
|
|
3592
3614
|
unregisteredForEvent
|
|
3593
3615
|
).map((startDate) => ({
|
|
3594
|
-
label:
|
|
3616
|
+
label: formatDateOptionLabel(startDate),
|
|
3595
3617
|
value: startDate
|
|
3596
3618
|
}));
|
|
3597
3619
|
const hasDatePills = futureEventStartDates.length > 0;
|
|
@@ -3619,7 +3641,7 @@ function getVendorEventsData({
|
|
|
3619
3641
|
const eventDateOptions = getVendorEventRelationDateOptions(events).map(
|
|
3620
3642
|
(option) => ({
|
|
3621
3643
|
...option,
|
|
3622
|
-
label:
|
|
3644
|
+
label: formatDateOptionLabel(option.value)
|
|
3623
3645
|
})
|
|
3624
3646
|
);
|
|
3625
3647
|
return {
|
|
@@ -10786,6 +10808,7 @@ function canAccessAdminPath(roles, pathname) {
|
|
|
10786
10808
|
foodFlavourOptions,
|
|
10787
10809
|
formatCategoryLabel,
|
|
10788
10810
|
formatDate,
|
|
10811
|
+
formatDateOptionLabel,
|
|
10789
10812
|
formatDistance,
|
|
10790
10813
|
formatIrdNumber,
|
|
10791
10814
|
formatNZBankAccount,
|
|
@@ -10854,6 +10877,7 @@ function canAccessAdminPath(roles, pathname) {
|
|
|
10854
10877
|
isInternalErrorMessage,
|
|
10855
10878
|
isIsoDateString,
|
|
10856
10879
|
isNonVisitorResourceType,
|
|
10880
|
+
isPastDate,
|
|
10857
10881
|
isPostShareResourceType,
|
|
10858
10882
|
isRelationShareResourceType,
|
|
10859
10883
|
isResourceImageActive,
|