@zag-js/date-utils 0.1.0 → 0.1.1

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/assertion.js CHANGED
@@ -47,7 +47,7 @@ function isDateUnavailable(date, isUnavailable, minValue, maxValue) {
47
47
  if (!date) {
48
48
  return false;
49
49
  }
50
- if (isUnavailable == null ? void 0 : isUnavailable(date)) {
50
+ if (isUnavailable?.(date)) {
51
51
  return true;
52
52
  }
53
53
  return isDateInvalid(date, minValue, maxValue);
@@ -7,7 +7,7 @@ import {
7
7
  isNextVisibleRangeInvalid,
8
8
  isPreviousVisibleRangeInvalid,
9
9
  isTodayDate
10
- } from "./chunk-6EJZROXM.mjs";
10
+ } from "./chunk-H4CAPQVS.mjs";
11
11
  export {
12
12
  isDateDisabled,
13
13
  isDateEqual,
@@ -21,8 +21,7 @@ function isSegmentEditable(segment) {
21
21
  return EDITABLE_SEGMENTS[segment];
22
22
  }
23
23
  function getSegmentPageStep(segment) {
24
- var _a;
25
- return (_a = SEGMENT_PAGE_STEP[segment]) != null ? _a : 1;
24
+ return SEGMENT_PAGE_STEP[segment] ?? 1;
26
25
  }
27
26
 
28
27
  export {
@@ -19,7 +19,7 @@ function addSegment(date, part, amount, options) {
19
19
  case "second":
20
20
  return date.cycle(part, amount, {
21
21
  round: part !== "hour",
22
- hourCycle: (options == null ? void 0 : options.hour12) ? 12 : 24
22
+ hourCycle: options?.hour12 ? 12 : 24
23
23
  });
24
24
  }
25
25
  }
@@ -42,7 +42,7 @@ function setSegment(date, part, value, options) {
42
42
  return isPM === wasPM ? date : date.set({ hour: wasPM ? hours - 12 : hours + 12 });
43
43
  }
44
44
  case "hour":
45
- if (options == null ? void 0 : options.hour12) {
45
+ if (options?.hour12) {
46
46
  let hours = date.hour;
47
47
  let wasPM = hours >= 12;
48
48
  if (!wasPM && value === 12) {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getDateFormatter,
6
6
  getMonthFormatter
7
- } from "./chunk-BBE325GQ.mjs";
7
+ } from "./chunk-TSOWYV6W.mjs";
8
8
 
9
9
  // src/format-visible-range.ts
10
10
  import { endOfMonth, isSameDay, startOfMonth } from "@internationalized/date";
@@ -12,7 +12,7 @@ function formatVisibleRange(startDate, endDate, getFormatter, isAria, timeZone)
12
12
  if (!startDate)
13
13
  return "";
14
14
  let start = startDate;
15
- let end = endDate != null ? endDate : startDate;
15
+ let end = endDate ?? startDate;
16
16
  let monthFormatter = getMonthFormatter(start, end, getFormatter, timeZone);
17
17
  let dateFormatter = getDateFormatter(start, end, getFormatter, timeZone);
18
18
  if (!isSameDay(start, startOfMonth(start))) {
@@ -16,7 +16,7 @@ function isDateUnavailable(date, isUnavailable, minValue, maxValue) {
16
16
  if (!date) {
17
17
  return false;
18
18
  }
19
- if (isUnavailable == null ? void 0 : isUnavailable(date)) {
19
+ if (isUnavailable?.(date)) {
20
20
  return true;
21
21
  }
22
22
  return isDateInvalid(date, minValue, maxValue);
@@ -5,9 +5,8 @@ import {
5
5
  // src/get-month-dates.ts
6
6
  import { getWeeksInMonth } from "@internationalized/date";
7
7
  function getMonthDates(startDate, duration, locale) {
8
- var _a;
9
8
  let weeksInMonth = getWeeksInMonth(startDate, locale);
10
- let numOfWeeks = (_a = duration.weeks) != null ? _a : weeksInMonth;
9
+ let numOfWeeks = duration.weeks ?? weeksInMonth;
11
10
  let weekArr = [...new Array(numOfWeeks).keys()];
12
11
  return weekArr.map((index) => {
13
12
  return getDatesInWeek(index, startDate, locale);
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-HKHGJ6WS.mjs";
4
4
  import {
5
5
  getDateFormatter
6
- } from "./chunk-BBE325GQ.mjs";
6
+ } from "./chunk-TSOWYV6W.mjs";
7
7
 
8
8
  // src/format-selected-date.ts
9
9
  import { isSameDay } from "@internationalized/date";
10
10
  function formatSelectedDate(startDate, endDate, getFormatter, isSelectingRange, timeZone) {
11
11
  let start = startDate;
12
- let end = endDate != null ? endDate : startDate;
12
+ let end = endDate ?? startDate;
13
13
  let formatter = getDateFormatter(start, end, getFormatter, timeZone);
14
14
  if (isSelectingRange || start == null || end == null) {
15
15
  return "";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getSegmentLimits
3
- } from "./chunk-HL7SOSTW.mjs";
3
+ } from "./chunk-U6WRBS5P.mjs";
4
4
  import {
5
5
  getTodayPlaceholderDate
6
6
  } from "./chunk-DZM5JUL2.mjs";
7
7
  import {
8
8
  isSegmentEditable
9
- } from "./chunk-RJCAPB5F.mjs";
9
+ } from "./chunk-55BYHK5B.mjs";
10
10
 
11
11
  // src/segment-parts.ts
12
12
  function getAllSegments(segments) {
@@ -1,10 +1,10 @@
1
1
  // src/get-formatter.ts
2
2
  function getEraFormat(date) {
3
- return (date == null ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : void 0;
3
+ return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
4
4
  }
5
5
  function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
6
6
  let start = startDate;
7
- let end = endDate != null ? endDate : startDate;
7
+ let end = endDate ?? startDate;
8
8
  let era = getEraFormat(start) || getEraFormat(end);
9
9
  return getDateFormatter2({
10
10
  weekday: "long",
@@ -17,13 +17,13 @@ function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
17
17
  }
18
18
  function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
19
19
  let start = startDate;
20
- let end = endDate != null ? endDate : startDate;
20
+ let end = endDate ?? startDate;
21
21
  let era = getEraFormat(start) || getEraFormat(end);
22
22
  return getDateFormatter2({
23
23
  month: "long",
24
24
  year: "numeric",
25
25
  era,
26
- calendar: start == null ? void 0 : start.calendar.identifier,
26
+ calendar: start?.calendar.identifier,
27
27
  timeZone
28
28
  });
29
29
  }
@@ -38,7 +38,7 @@ function getSegmentLimits(date, type, options) {
38
38
  max: 12
39
39
  };
40
40
  case "hour":
41
- if (options == null ? void 0 : options.hour12) {
41
+ if (options?.hour12) {
42
42
  let isPM = date.hour >= 12;
43
43
  return {
44
44
  value: date.hour,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isDateInvalid
3
- } from "./chunk-6EJZROXM.mjs";
3
+ } from "./chunk-H4CAPQVS.mjs";
4
4
  import {
5
5
  alignEnd,
6
6
  alignStart,
@@ -51,11 +51,11 @@ function formatRange(startDate, endDate, formatter, toString, timeZone) {
51
51
 
52
52
  // src/get-formatter.ts
53
53
  function getEraFormat(date) {
54
- return (date == null ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : void 0;
54
+ return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
55
55
  }
56
56
  function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
57
57
  let start = startDate;
58
- let end = endDate != null ? endDate : startDate;
58
+ let end = endDate ?? startDate;
59
59
  let era = getEraFormat(start) || getEraFormat(end);
60
60
  return getDateFormatter2({
61
61
  weekday: "long",
@@ -70,7 +70,7 @@ function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
70
70
  // src/format-selected-date.ts
71
71
  function formatSelectedDate(startDate, endDate, getFormatter, isSelectingRange, timeZone) {
72
72
  let start = startDate;
73
- let end = endDate != null ? endDate : startDate;
73
+ let end = endDate ?? startDate;
74
74
  let formatter = getDateFormatter(start, end, getFormatter, timeZone);
75
75
  if (isSelectingRange || start == null || end == null) {
76
76
  return "";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  formatSelectedDate
3
- } from "./chunk-GKU5M6QU.mjs";
3
+ } from "./chunk-NXMEZINO.mjs";
4
4
  import "./chunk-HKHGJ6WS.mjs";
5
- import "./chunk-BBE325GQ.mjs";
5
+ import "./chunk-TSOWYV6W.mjs";
6
6
  export {
7
7
  formatSelectedDate
8
8
  };
@@ -51,11 +51,11 @@ function formatRange(startDate, endDate, formatter, toString, timeZone) {
51
51
 
52
52
  // src/get-formatter.ts
53
53
  function getEraFormat(date) {
54
- return (date == null ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : void 0;
54
+ return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
55
55
  }
56
56
  function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
57
57
  let start = startDate;
58
- let end = endDate != null ? endDate : startDate;
58
+ let end = endDate ?? startDate;
59
59
  let era = getEraFormat(start) || getEraFormat(end);
60
60
  return getDateFormatter2({
61
61
  weekday: "long",
@@ -68,13 +68,13 @@ function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
68
68
  }
69
69
  function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
70
70
  let start = startDate;
71
- let end = endDate != null ? endDate : startDate;
71
+ let end = endDate ?? startDate;
72
72
  let era = getEraFormat(start) || getEraFormat(end);
73
73
  return getDateFormatter2({
74
74
  month: "long",
75
75
  year: "numeric",
76
76
  era,
77
- calendar: start == null ? void 0 : start.calendar.identifier,
77
+ calendar: start?.calendar.identifier,
78
78
  timeZone
79
79
  });
80
80
  }
@@ -84,7 +84,7 @@ function formatVisibleRange(startDate, endDate, getFormatter, isAria, timeZone)
84
84
  if (!startDate)
85
85
  return "";
86
86
  let start = startDate;
87
- let end = endDate != null ? endDate : startDate;
87
+ let end = endDate ?? startDate;
88
88
  let monthFormatter = getMonthFormatter(start, end, getFormatter, timeZone);
89
89
  let dateFormatter = getDateFormatter(start, end, getFormatter, timeZone);
90
90
  if (!(0, import_date.isSameDay)(start, (0, import_date.startOfMonth)(start))) {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  formatVisibleRange
3
- } from "./chunk-URPTPFL3.mjs";
3
+ } from "./chunk-GLQDJRSE.mjs";
4
4
  import "./chunk-HKHGJ6WS.mjs";
5
- import "./chunk-BBE325GQ.mjs";
5
+ import "./chunk-TSOWYV6W.mjs";
6
6
  export {
7
7
  formatVisibleRange
8
8
  };
@@ -25,11 +25,11 @@ __export(get_formatter_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(get_formatter_exports);
27
27
  function getEraFormat(date) {
28
- return (date == null ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : void 0;
28
+ return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
29
29
  }
30
30
  function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
31
31
  let start = startDate;
32
- let end = endDate != null ? endDate : startDate;
32
+ let end = endDate ?? startDate;
33
33
  let era = getEraFormat(start) || getEraFormat(end);
34
34
  return getDateFormatter2({
35
35
  weekday: "long",
@@ -42,13 +42,13 @@ function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
42
42
  }
43
43
  function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
44
44
  let start = startDate;
45
- let end = endDate != null ? endDate : startDate;
45
+ let end = endDate ?? startDate;
46
46
  let era = getEraFormat(start) || getEraFormat(end);
47
47
  return getDateFormatter2({
48
48
  month: "long",
49
49
  year: "numeric",
50
50
  era,
51
- calendar: start == null ? void 0 : start.calendar.identifier,
51
+ calendar: start?.calendar.identifier,
52
52
  timeZone
53
53
  });
54
54
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDateFormatter,
3
3
  getMonthFormatter
4
- } from "./chunk-BBE325GQ.mjs";
4
+ } from "./chunk-TSOWYV6W.mjs";
5
5
  export {
6
6
  getDateFormatter,
7
7
  getMonthFormatter
@@ -51,9 +51,8 @@ function getDatesInWeek(weekIndex, fromDate, locale) {
51
51
 
52
52
  // src/get-month-dates.ts
53
53
  function getMonthDates(startDate, duration, locale) {
54
- var _a;
55
54
  let weeksInMonth = (0, import_date2.getWeeksInMonth)(startDate, locale);
56
- let numOfWeeks = (_a = duration.weeks) != null ? _a : weeksInMonth;
55
+ let numOfWeeks = duration.weeks ?? weeksInMonth;
57
56
  let weekArr = [...new Array(numOfWeeks).keys()];
58
57
  return weekArr.map((index) => {
59
58
  return getDatesInWeek(index, startDate, locale);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMonthDates
3
- } from "./chunk-HUBKWHIN.mjs";
3
+ } from "./chunk-MGRIF22W.mjs";
4
4
  import "./chunk-JZVHAOWX.mjs";
5
5
  export {
6
6
  getMonthDates
package/dist/index.js CHANGED
@@ -171,7 +171,7 @@ function isDateUnavailable(date, isUnavailable, minValue, maxValue) {
171
171
  if (!date) {
172
172
  return false;
173
173
  }
174
- if (isUnavailable == null ? void 0 : isUnavailable(date)) {
174
+ if (isUnavailable?.(date)) {
175
175
  return true;
176
176
  }
177
177
  return isDateInvalid(date, minValue, maxValue);
@@ -235,11 +235,11 @@ var import_date3 = require("@internationalized/date");
235
235
 
236
236
  // src/get-formatter.ts
237
237
  function getEraFormat(date) {
238
- return (date == null ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : void 0;
238
+ return date?.calendar.identifier === "gregory" && date.era === "BC" ? "short" : void 0;
239
239
  }
240
240
  function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
241
241
  let start = startDate;
242
- let end = endDate != null ? endDate : startDate;
242
+ let end = endDate ?? startDate;
243
243
  let era = getEraFormat(start) || getEraFormat(end);
244
244
  return getDateFormatter2({
245
245
  weekday: "long",
@@ -252,13 +252,13 @@ function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
252
252
  }
253
253
  function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
254
254
  let start = startDate;
255
- let end = endDate != null ? endDate : startDate;
255
+ let end = endDate ?? startDate;
256
256
  let era = getEraFormat(start) || getEraFormat(end);
257
257
  return getDateFormatter2({
258
258
  month: "long",
259
259
  year: "numeric",
260
260
  era,
261
- calendar: start == null ? void 0 : start.calendar.identifier,
261
+ calendar: start?.calendar.identifier,
262
262
  timeZone
263
263
  });
264
264
  }
@@ -266,7 +266,7 @@ function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
266
266
  // src/format-selected-date.ts
267
267
  function formatSelectedDate(startDate, endDate, getFormatter, isSelectingRange, timeZone) {
268
268
  let start = startDate;
269
- let end = endDate != null ? endDate : startDate;
269
+ let end = endDate ?? startDate;
270
270
  let formatter = getDateFormatter(start, end, getFormatter, timeZone);
271
271
  if (isSelectingRange || start == null || end == null) {
272
272
  return "";
@@ -283,7 +283,7 @@ function formatVisibleRange(startDate, endDate, getFormatter, isAria, timeZone)
283
283
  if (!startDate)
284
284
  return "";
285
285
  let start = startDate;
286
- let end = endDate != null ? endDate : startDate;
286
+ let end = endDate ?? startDate;
287
287
  let monthFormatter = getMonthFormatter(start, end, getFormatter, timeZone);
288
288
  let dateFormatter = getDateFormatter(start, end, getFormatter, timeZone);
289
289
  if (!(0, import_date4.isSameDay)(start, (0, import_date4.startOfMonth)(start))) {
@@ -333,9 +333,8 @@ function getWeekDates(fromDate, timeZone, locale) {
333
333
 
334
334
  // src/get-month-dates.ts
335
335
  function getMonthDates(startDate, duration, locale) {
336
- var _a;
337
336
  let weeksInMonth = (0, import_date6.getWeeksInMonth)(startDate, locale);
338
- let numOfWeeks = (_a = duration.weeks) != null ? _a : weeksInMonth;
337
+ let numOfWeeks = duration.weeks ?? weeksInMonth;
339
338
  let weekArr = [...new Array(numOfWeeks).keys()];
340
339
  return weekArr.map((index) => {
341
340
  return getDatesInWeek(index, startDate, locale);
@@ -604,8 +603,7 @@ function isSegmentEditable(segment) {
604
603
  return EDITABLE_SEGMENTS[segment];
605
604
  }
606
605
  function getSegmentPageStep(segment) {
607
- var _a;
608
- return (_a = SEGMENT_PAGE_STEP[segment]) != null ? _a : 1;
606
+ return SEGMENT_PAGE_STEP[segment] ?? 1;
609
607
  }
610
608
 
611
609
  // src/segment-limit.ts
@@ -648,7 +646,7 @@ function getSegmentLimits(date, type, options) {
648
646
  max: 12
649
647
  };
650
648
  case "hour":
651
- if (options == null ? void 0 : options.hour12) {
649
+ if (options?.hour12) {
652
650
  let isPM = date.hour >= 12;
653
651
  return {
654
652
  value: date.hour,
@@ -703,7 +701,7 @@ function addSegment(date, part, amount, options) {
703
701
  case "second":
704
702
  return date.cycle(part, amount, {
705
703
  round: part !== "hour",
706
- hourCycle: (options == null ? void 0 : options.hour12) ? 12 : 24
704
+ hourCycle: options?.hour12 ? 12 : 24
707
705
  });
708
706
  }
709
707
  }
@@ -726,7 +724,7 @@ function setSegment(date, part, value, options) {
726
724
  return isPM === wasPM ? date : date.set({ hour: wasPM ? hours - 12 : hours + 12 });
727
725
  }
728
726
  case "hour":
729
- if (options == null ? void 0 : options.hour12) {
727
+ if (options?.hour12) {
730
728
  let hours = date.hour;
731
729
  let wasPM = hours >= 12;
732
730
  if (!wasPM && value === 12) {
package/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  addSegment,
3
3
  setSegment
4
- } from "./chunk-CAV5WKCZ.mjs";
4
+ } from "./chunk-ETRHBIGD.mjs";
5
5
  import {
6
6
  getAllSegments,
7
7
  getSegments
8
- } from "./chunk-DETLHDDR.mjs";
8
+ } from "./chunk-SQCHVCXH.mjs";
9
9
  import {
10
10
  getSegmentLimits
11
- } from "./chunk-HL7SOSTW.mjs";
11
+ } from "./chunk-U6WRBS5P.mjs";
12
12
  import {
13
13
  getMonthDates
14
- } from "./chunk-HUBKWHIN.mjs";
14
+ } from "./chunk-MGRIF22W.mjs";
15
15
  import {
16
16
  getDatesInWeek,
17
17
  getWeekDates
@@ -39,7 +39,7 @@ import {
39
39
  getPreviousSection,
40
40
  getSectionEnd,
41
41
  getSectionStart
42
- } from "./chunk-BRQVXAVZ.mjs";
42
+ } from "./chunk-VTFZA34K.mjs";
43
43
  import {
44
44
  createPlaceholderDate,
45
45
  getTodayPlaceholderDate
@@ -48,7 +48,7 @@ import {
48
48
  SEGMENT_PAGE_STEP,
49
49
  getSegmentPageStep,
50
50
  isSegmentEditable
51
- } from "./chunk-RJCAPB5F.mjs";
51
+ } from "./chunk-55BYHK5B.mjs";
52
52
  import {
53
53
  alignDate,
54
54
  alignStartDate
@@ -62,7 +62,7 @@ import {
62
62
  isNextVisibleRangeInvalid,
63
63
  isPreviousVisibleRangeInvalid,
64
64
  isTodayDate
65
- } from "./chunk-6EJZROXM.mjs";
65
+ } from "./chunk-H4CAPQVS.mjs";
66
66
  import {
67
67
  alignCenter,
68
68
  alignEnd,
@@ -76,14 +76,14 @@ import {
76
76
  } from "./chunk-ZSLC7OI2.mjs";
77
77
  import {
78
78
  formatSelectedDate
79
- } from "./chunk-GKU5M6QU.mjs";
79
+ } from "./chunk-NXMEZINO.mjs";
80
80
  import {
81
81
  formatVisibleRange
82
- } from "./chunk-URPTPFL3.mjs";
82
+ } from "./chunk-GLQDJRSE.mjs";
83
83
  import {
84
84
  formatRange
85
85
  } from "./chunk-HKHGJ6WS.mjs";
86
- import "./chunk-BBE325GQ.mjs";
86
+ import "./chunk-TSOWYV6W.mjs";
87
87
  export {
88
88
  SEGMENT_PAGE_STEP,
89
89
  addSegment,
@@ -8,8 +8,8 @@ import {
8
8
  getPreviousSection,
9
9
  getSectionEnd,
10
10
  getSectionStart
11
- } from "./chunk-BRQVXAVZ.mjs";
12
- import "./chunk-6EJZROXM.mjs";
11
+ } from "./chunk-VTFZA34K.mjs";
12
+ import "./chunk-H4CAPQVS.mjs";
13
13
  import "./chunk-MGPXEJO4.mjs";
14
14
  import "./chunk-ZSLC7OI2.mjs";
15
15
  export {
@@ -47,8 +47,7 @@ function isSegmentEditable(segment) {
47
47
  return EDITABLE_SEGMENTS[segment];
48
48
  }
49
49
  function getSegmentPageStep(segment) {
50
- var _a;
51
- return (_a = SEGMENT_PAGE_STEP[segment]) != null ? _a : 1;
50
+ return SEGMENT_PAGE_STEP[segment] ?? 1;
52
51
  }
53
52
  // Annotate the CommonJS export names for ESM import in node:
54
53
  0 && (module.exports = {
@@ -2,7 +2,7 @@ import {
2
2
  SEGMENT_PAGE_STEP,
3
3
  getSegmentPageStep,
4
4
  isSegmentEditable
5
- } from "./chunk-RJCAPB5F.mjs";
5
+ } from "./chunk-55BYHK5B.mjs";
6
6
  export {
7
7
  SEGMENT_PAGE_STEP,
8
8
  getSegmentPageStep,
@@ -62,7 +62,7 @@ function getSegmentLimits(date, type, options) {
62
62
  max: 12
63
63
  };
64
64
  case "hour":
65
- if (options == null ? void 0 : options.hour12) {
65
+ if (options?.hour12) {
66
66
  let isPM = date.hour >= 12;
67
67
  return {
68
68
  value: date.hour,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getSegmentLimits
3
- } from "./chunk-HL7SOSTW.mjs";
3
+ } from "./chunk-U6WRBS5P.mjs";
4
4
  export {
5
5
  getSegmentLimits
6
6
  };
@@ -44,7 +44,7 @@ function addSegment(date, part, amount, options) {
44
44
  case "second":
45
45
  return date.cycle(part, amount, {
46
46
  round: part !== "hour",
47
- hourCycle: (options == null ? void 0 : options.hour12) ? 12 : 24
47
+ hourCycle: options?.hour12 ? 12 : 24
48
48
  });
49
49
  }
50
50
  }
@@ -67,7 +67,7 @@ function setSegment(date, part, value, options) {
67
67
  return isPM === wasPM ? date : date.set({ hour: wasPM ? hours - 12 : hours + 12 });
68
68
  }
69
69
  case "hour":
70
- if (options == null ? void 0 : options.hour12) {
70
+ if (options?.hour12) {
71
71
  let hours = date.hour;
72
72
  let wasPM = hours >= 12;
73
73
  if (!wasPM && value === 12) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  addSegment,
3
3
  setSegment
4
- } from "./chunk-CAV5WKCZ.mjs";
4
+ } from "./chunk-ETRHBIGD.mjs";
5
5
  export {
6
6
  addSegment,
7
7
  setSegment
@@ -91,7 +91,7 @@ function getSegmentLimits(date, type, options) {
91
91
  max: 12
92
92
  };
93
93
  case "hour":
94
- if (options == null ? void 0 : options.hour12) {
94
+ if (options?.hour12) {
95
95
  let isPM = date.hour >= 12;
96
96
  return {
97
97
  value: date.hour,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getAllSegments,
3
3
  getSegments
4
- } from "./chunk-DETLHDDR.mjs";
5
- import "./chunk-HL7SOSTW.mjs";
4
+ } from "./chunk-SQCHVCXH.mjs";
5
+ import "./chunk-U6WRBS5P.mjs";
6
6
  import "./chunk-DZM5JUL2.mjs";
7
- import "./chunk-RJCAPB5F.mjs";
7
+ import "./chunk-55BYHK5B.mjs";
8
8
  export {
9
9
  getAllSegments,
10
10
  getSegments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/date-utils",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Date utilities for zag.js",
5
5
  "keywords": [
6
6
  "js",