@zag-js/date-utils 0.0.0-dev-20230107115230 → 0.0.0-dev-20230107153917

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 (72) hide show
  1. package/dist/align.d.ts +4 -4
  2. package/dist/align.js +20 -24
  3. package/dist/align.mjs +2 -2
  4. package/dist/assertion.d.ts +8 -8
  5. package/dist/assertion.js +15 -16
  6. package/dist/assertion.mjs +1 -1
  7. package/dist/chunk-6EJZROXM.mjs +45 -0
  8. package/dist/{chunk-TCPXGBJP.mjs → chunk-BBE325GQ.mjs} +9 -8
  9. package/dist/chunk-BUT5IUNZ.mjs +32 -0
  10. package/dist/{chunk-EXWX3KZT.mjs → chunk-CAV5WKCZ.mjs} +4 -2
  11. package/dist/chunk-GKU5M6QU.mjs +25 -0
  12. package/dist/{chunk-XHAL6X5Z.mjs → chunk-HKHGJ6WS.mjs} +3 -3
  13. package/dist/{chunk-ECAENYV6.mjs → chunk-HUBKWHIN.mjs} +1 -1
  14. package/dist/{chunk-M4F23P2U.mjs → chunk-JZVHAOWX.mjs} +3 -3
  15. package/dist/{chunk-2DZ3KIVJ.mjs → chunk-L3YHK2WH.mjs} +1 -1
  16. package/dist/chunk-MGPXEJO4.mjs +71 -0
  17. package/dist/chunk-MY373KF2.mjs +198 -0
  18. package/dist/chunk-URPTPFL3.mjs +31 -0
  19. package/dist/chunk-ZZPZ2BFS.mjs +52 -0
  20. package/dist/constrain.d.ts +6 -7
  21. package/dist/constrain.js +20 -25
  22. package/dist/constrain.mjs +1 -1
  23. package/dist/format-range.d.ts +2 -3
  24. package/dist/format-range.js +3 -3
  25. package/dist/format-range.mjs +1 -1
  26. package/dist/format-selected-date.d.ts +3 -3
  27. package/dist/format-selected-date.js +13 -13
  28. package/dist/format-selected-date.mjs +3 -4
  29. package/dist/format-visible-range.d.ts +3 -3
  30. package/dist/format-visible-range.js +18 -17
  31. package/dist/format-visible-range.mjs +4 -26
  32. package/dist/get-formatter.d.ts +4 -3
  33. package/dist/get-formatter.js +6 -8
  34. package/dist/get-formatter.mjs +1 -2
  35. package/dist/get-month-dates.mjs +2 -2
  36. package/dist/get-week-dates.d.ts +1 -1
  37. package/dist/get-week-dates.js +2 -2
  38. package/dist/get-week-dates.mjs +1 -1
  39. package/dist/index.d.ts +3 -2
  40. package/dist/index.js +284 -181
  41. package/dist/index.mjs +22 -19
  42. package/dist/mutation.d.ts +5 -5
  43. package/dist/mutation.js +16 -43
  44. package/dist/mutation.mjs +4 -5
  45. package/dist/pagination.d.ts +29 -10
  46. package/dist/pagination.js +183 -89
  47. package/dist/pagination.mjs +3 -2
  48. package/dist/placeholder.d.ts +1 -1
  49. package/dist/segment-constants.d.ts +1 -1
  50. package/dist/segment-limit.d.ts +2 -2
  51. package/dist/segment-limit.js +1 -1
  52. package/dist/segment-limit.mjs +1 -1
  53. package/dist/segment-mutation.d.ts +3 -4
  54. package/dist/segment-mutation.js +4 -2
  55. package/dist/segment-mutation.mjs +1 -1
  56. package/dist/segment-parts.d.ts +2 -2
  57. package/dist/segment-parts.js +4 -4
  58. package/dist/segment-parts.mjs +6 -6
  59. package/dist/types-cbf8b45a.d.ts +35 -0
  60. package/dist/types.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/dist/chunk-6XKXGQP6.mjs +0 -32
  63. package/dist/chunk-7JERMWT3.mjs +0 -46
  64. package/dist/chunk-C4U2N3JC.mjs +0 -65
  65. package/dist/chunk-DI2YG6VG.mjs +0 -24
  66. package/dist/chunk-FJMTHABG.mjs +0 -8
  67. package/dist/chunk-HP2COJGP.mjs +0 -76
  68. package/dist/chunk-VWVBJ5CB.mjs +0 -110
  69. package/dist/get-era-format.d.ts +0 -5
  70. package/dist/get-era-format.js +0 -32
  71. package/dist/get-era-format.mjs +0 -6
  72. package/dist/types-9f60d2f1.d.ts +0 -61
@@ -24,15 +24,12 @@ __export(get_formatter_exports, {
24
24
  getMonthFormatter: () => getMonthFormatter
25
25
  });
26
26
  module.exports = __toCommonJS(get_formatter_exports);
27
-
28
- // src/get-era-format.ts
29
27
  function getEraFormat(date) {
30
28
  return (date == null ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : void 0;
31
29
  }
32
-
33
- // src/get-formatter.ts
34
- function getDateFormatter(ctx) {
35
- const { start, end = start, getDateFormatter: getDateFormatter2, timeZone } = ctx;
30
+ function getDateFormatter(startDate, endDate, getDateFormatter2, timeZone) {
31
+ let start = startDate;
32
+ let end = endDate != null ? endDate : startDate;
36
33
  let era = getEraFormat(start) || getEraFormat(end);
37
34
  return getDateFormatter2({
38
35
  weekday: "long",
@@ -43,8 +40,9 @@ function getDateFormatter(ctx) {
43
40
  timeZone
44
41
  });
45
42
  }
46
- function getMonthFormatter(ctx) {
47
- const { start, end = start, getDateFormatter: getDateFormatter2, timeZone } = ctx;
43
+ function getMonthFormatter(startDate, endDate, getDateFormatter2, timeZone) {
44
+ let start = startDate;
45
+ let end = endDate != null ? endDate : startDate;
48
46
  let era = getEraFormat(start) || getEraFormat(end);
49
47
  return getDateFormatter2({
50
48
  month: "long",
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  getDateFormatter,
3
3
  getMonthFormatter
4
- } from "./chunk-TCPXGBJP.mjs";
5
- import "./chunk-FJMTHABG.mjs";
4
+ } from "./chunk-BBE325GQ.mjs";
6
5
  export {
7
6
  getDateFormatter,
8
7
  getMonthFormatter
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getMonthDates
3
- } from "./chunk-ECAENYV6.mjs";
4
- import "./chunk-M4F23P2U.mjs";
3
+ } from "./chunk-HUBKWHIN.mjs";
4
+ import "./chunk-JZVHAOWX.mjs";
5
5
  export {
6
6
  getMonthDates
7
7
  };
@@ -2,6 +2,6 @@ import { CalendarDate } from '@internationalized/date';
2
2
 
3
3
  type DatesInWeek = (CalendarDate | null)[];
4
4
  declare function getDatesInWeek(weekIndex: number, fromDate: CalendarDate, locale: string): (CalendarDate | null)[];
5
- declare function getWeekDates(timeZone: string, locale: string): Date[];
5
+ declare function getWeekDates(fromDate: CalendarDate, timeZone: string, locale: string): Date[];
6
6
 
7
7
  export { DatesInWeek, getDatesInWeek, getWeekDates };
@@ -46,8 +46,8 @@ function getDatesInWeek(weekIndex, fromDate, locale) {
46
46
  }
47
47
  return dates;
48
48
  }
49
- function getWeekDates(timeZone, locale) {
50
- let weekStart = (0, import_date.startOfWeek)((0, import_date.today)(timeZone), locale);
49
+ function getWeekDates(fromDate, timeZone, locale) {
50
+ let weekStart = (0, import_date.startOfWeek)(fromDate, locale);
51
51
  let weekArr = [...new Array(7).keys()];
52
52
  return weekArr.map((index) => {
53
53
  return weekStart.add({ days: index }).toDate(timeZone);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDatesInWeek,
3
3
  getWeekDates
4
- } from "./chunk-M4F23P2U.mjs";
4
+ } from "./chunk-JZVHAOWX.mjs";
5
5
  export {
6
6
  getDatesInWeek,
7
7
  getWeekDates
package/dist/index.d.ts CHANGED
@@ -4,12 +4,13 @@ export { alignCenter, alignEnd, alignStart, constrainStart, constrainValue } fro
4
4
  export { getEndDate, getUnitDuration } from './duration.js';
5
5
  export { formatRange } from './format-range.js';
6
6
  export { formatSelectedDate } from './format-selected-date.js';
7
+ export { formatVisibleRange } from './format-visible-range.js';
7
8
  export { DatesInWeek, getDatesInWeek, getWeekDates } from './get-week-dates.js';
8
9
  export { getMonthDates } from './get-month-dates.js';
9
10
  export { YearsRange, getYearsRange } from './get-year-range.js';
10
- export { clampDate, getNextDay, getPreviousDay, getTodayDate, setCalendar, setDate, setMonth, setYear } from './mutation.js';
11
+ export { getNextDay, getPreviousAvailableDate, getPreviousDay, getTodayDate, setCalendar, setDate, setMonth, setYear } from './mutation.js';
11
12
  export { getNextPage, getNextRow, getNextSection, getPreviousPage, getPreviousRow, getPreviousSection, getSectionEnd, getSectionStart } from './pagination.js';
12
- export { c as DateGranularity, d as DateSegments, S as SEGMENT_PAGE_STEP, i as isSegmentEditable } from './types-9f60d2f1.js';
13
+ export { b as DateGranularity, c as DateSegments, S as SEGMENT_PAGE_STEP, i as isSegmentEditable } from './types-cbf8b45a.js';
13
14
  export { getSegmentLimits } from './segment-limit.js';
14
15
  export { addSegment, setSegment } from './segment-mutation.js';
15
16
  import '@internationalized/date';