chronal 0.0.5 → 0.0.7
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/README.md +23 -23
- package/esm/chainable/chronal.d.ts +11 -5
- package/esm/chainable/chronal.d.ts.map +1 -1
- package/esm/chainable/chronal.js +8 -31
- package/esm/chainable/{date-range.d.ts → dates-until.d.ts} +6 -6
- package/esm/chainable/dates-until.d.ts.map +1 -0
- package/esm/chainable/{date-range.js → dates-until.js} +6 -6
- package/esm/chainable/end-of.d.ts.map +1 -1
- package/{script/chainable/sub-time.d.ts → esm/chainable/subtract.d.ts} +4 -4
- package/esm/chainable/subtract.d.ts.map +1 -0
- package/esm/chainable/{sub-time.js → subtract.js} +4 -4
- package/esm/lib/config.d.ts +1 -1
- package/esm/lib/config.d.ts.map +1 -1
- package/esm/lib/config.js +1 -1
- package/{script/lib/date-range.d.ts → esm/lib/dates-until.d.ts} +5 -5
- package/esm/lib/dates-until.d.ts.map +1 -0
- package/esm/lib/{date-range.js → dates-until.js} +4 -4
- package/esm/lib/end-of.d.ts.map +1 -1
- package/esm/lib/end-of.js +0 -10
- package/esm/lib/start-of.d.ts.map +1 -1
- package/esm/lib/start-of.js +10 -8
- package/esm/lib/{sub-time.d.ts → subtract-time.d.ts} +3 -3
- package/esm/lib/subtract-time.d.ts.map +1 -0
- package/esm/lib/{sub-time.js → subtract-time.js} +2 -2
- package/esm/mod.d.ts +3 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -3
- package/package.json +1 -1
- package/script/chainable/chronal.d.ts +11 -5
- package/script/chainable/chronal.d.ts.map +1 -1
- package/script/chainable/chronal.js +8 -31
- package/script/chainable/{date-range.d.ts → dates-until.d.ts} +6 -6
- package/script/chainable/dates-until.d.ts.map +1 -0
- package/script/chainable/{date-range.js → dates-until.js} +7 -7
- package/script/chainable/end-of.d.ts.map +1 -1
- package/{esm/chainable/sub-time.d.ts → script/chainable/subtract.d.ts} +4 -4
- package/script/chainable/subtract.d.ts.map +1 -0
- package/script/chainable/{sub-time.js → subtract.js} +5 -5
- package/script/lib/config.d.ts +1 -1
- package/script/lib/config.d.ts.map +1 -1
- package/script/lib/config.js +2 -2
- package/{esm/lib/date-range.d.ts → script/lib/dates-until.d.ts} +5 -5
- package/script/lib/dates-until.d.ts.map +1 -0
- package/script/lib/{date-range.js → dates-until.js} +5 -5
- package/script/lib/end-of.d.ts.map +1 -1
- package/script/lib/end-of.js +0 -10
- package/script/lib/start-of.d.ts.map +1 -1
- package/script/lib/start-of.js +10 -8
- package/script/lib/{sub-time.d.ts → subtract-time.d.ts} +3 -3
- package/script/lib/subtract-time.d.ts.map +1 -0
- package/script/lib/{sub-time.js → subtract-time.js} +3 -3
- package/script/mod.d.ts +3 -3
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +6 -6
- package/esm/chainable/date-range.d.ts.map +0 -1
- package/esm/chainable/sub-time.d.ts.map +0 -1
- package/esm/lib/date-range.d.ts.map +0 -1
- package/esm/lib/sub-time.d.ts.map +0 -1
- package/script/chainable/date-range.d.ts.map +0 -1
- package/script/chainable/sub-time.d.ts.map +0 -1
- package/script/lib/date-range.d.ts.map +0 -1
- package/script/lib/sub-time.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ npm install chronal
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
```javascript
|
|
62
|
-
import { addTime, formatDate,
|
|
62
|
+
import { addTime, formatDate, subtract } from "chronal";
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
## Quick Start
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
isToday,
|
|
80
80
|
parseDate,
|
|
81
81
|
startOf,
|
|
82
|
-
|
|
82
|
+
subtract,
|
|
83
83
|
} from "chronal";
|
|
84
84
|
|
|
85
85
|
const date = new Date("2024-06-15T14:35:22Z");
|
|
@@ -94,7 +94,7 @@ parseDate("15/06/2024", "DD/MM/YYYY"); // Date object for June 15, 2024
|
|
|
94
94
|
|
|
95
95
|
// Add/subtract time
|
|
96
96
|
addTime(date, { days: 5, hours: 2 }); // 2024-06-20T16:35:22Z
|
|
97
|
-
|
|
97
|
+
subtract(date, { months: 1, days: 10 }); // 2024-05-05T14:35:22Z
|
|
98
98
|
|
|
99
99
|
// Start/End of period
|
|
100
100
|
startOf(date, "month"); // 2024-06-01T00:00:00.000Z
|
|
@@ -107,7 +107,7 @@ fromNow(new Date(Date.now() - 300000)); // "5 minutes ago"
|
|
|
107
107
|
isToday(new Date()); // true
|
|
108
108
|
|
|
109
109
|
// Generate date ranges
|
|
110
|
-
|
|
110
|
+
datesUntil(new Date("2024-01-01"), new Date("2024-01-05"));
|
|
111
111
|
// [2024-01-01, 2024-01-02, 2024-01-03, 2024-01-04, 2024-01-05]
|
|
112
112
|
```
|
|
113
113
|
|
|
@@ -129,7 +129,7 @@ console.log(date); // "2024-07-01"
|
|
|
129
129
|
// All methods available
|
|
130
130
|
const result = chronal("2024-01-15")
|
|
131
131
|
.add({ days: 10 })
|
|
132
|
-
.
|
|
132
|
+
.subtract({ hours: 2 })
|
|
133
133
|
.format("MMMM DD, YYYY"); // "January 25, 2024"
|
|
134
134
|
|
|
135
135
|
// Query methods
|
|
@@ -144,7 +144,7 @@ chronal("2024-06-15").daysInMonth(); // 30
|
|
|
144
144
|
|
|
145
145
|
// Generate date ranges
|
|
146
146
|
chronal("2024-01-01")
|
|
147
|
-
.
|
|
147
|
+
.until(new Date("2024-01-31"), { weeks: 1 })
|
|
148
148
|
.map((c) => c.format("YYYY-MM-DD"));
|
|
149
149
|
// ["2024-01-01", "2024-01-08", "2024-01-15", "2024-01-22", "2024-01-29"]
|
|
150
150
|
```
|
|
@@ -157,7 +157,7 @@ chronal("2024-01-01")
|
|
|
157
157
|
|
|
158
158
|
## Configuration
|
|
159
159
|
|
|
160
|
-
### `
|
|
160
|
+
### `setChronalConfig(config)`
|
|
161
161
|
|
|
162
162
|
Set the default configuration for all date operations.
|
|
163
163
|
|
|
@@ -169,18 +169,18 @@ Set the default configuration for all date operations.
|
|
|
169
169
|
**Example:**
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
-
import { formatDate, months,
|
|
172
|
+
import { formatDate, months, setChronalConfig } from "chronal";
|
|
173
173
|
|
|
174
174
|
// Default is 'en-US' and 'UTC'
|
|
175
175
|
formatDate(new Date("2024-06-15"), "MMMM"); // 'June'
|
|
176
176
|
|
|
177
177
|
// Change default locale
|
|
178
|
-
|
|
178
|
+
setChronalConfig({ locale: "pt-BR" });
|
|
179
179
|
formatDate(new Date("2024-06-15"), "MMMM"); // 'junho'
|
|
180
180
|
months(); // ['janeiro', 'fevereiro', 'março', ...]
|
|
181
181
|
|
|
182
182
|
// Change default timezone
|
|
183
|
-
|
|
183
|
+
setChronalConfig({ timezone: "America/Sao_Paulo" });
|
|
184
184
|
|
|
185
185
|
// You can still override per call
|
|
186
186
|
formatDate(new Date("2024-06-15"), "MMMM", { locale: "fr-FR" }); // 'juin'
|
|
@@ -210,7 +210,7 @@ All chainable methods correspond to functional API functions:
|
|
|
210
210
|
| Chainable Method | Functional API | Description |
|
|
211
211
|
| ------------------------- | ------------------------------------- | ------------------------ |
|
|
212
212
|
| `.add(options)` | `addTime(date, options)` | Add time units |
|
|
213
|
-
| `.subtract(options)` | `
|
|
213
|
+
| `.subtract(options)` | `subtract(date, options)` | Subtract time units |
|
|
214
214
|
| `.startOf(unit)` | `startOf(date, unit)` | Start of time unit |
|
|
215
215
|
| `.endOf(unit)` | `endOf(date, unit)` | End of time unit |
|
|
216
216
|
| `.set(options)` | `setUnit(date, options)` | Set specific units |
|
|
@@ -233,7 +233,7 @@ All chainable methods correspond to functional API functions:
|
|
|
233
233
|
| `.quarter()` | `getQuarter(date)` | Get quarter (1-4) |
|
|
234
234
|
| `.daysInMonth()` | `daysInMonth(date)` | Days in month |
|
|
235
235
|
| `.week()` | `weekOfYear(date)` | Week of year |
|
|
236
|
-
| `.
|
|
236
|
+
| `.until(end, step?)` | `datesUntil(start, end, step?)` | Generate date array |
|
|
237
237
|
|
|
238
238
|
**Example:**
|
|
239
239
|
|
|
@@ -379,7 +379,7 @@ addTime(date, { months: 1 }); // 2024-02-29T12:00:00.000Z (handles leap year)
|
|
|
379
379
|
addTime(date, { years: 1, months: 2, days: 3 }); // 2025-04-03T12:00:00.000Z
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
#### `
|
|
382
|
+
#### `subtract(date, options)`
|
|
383
383
|
|
|
384
384
|
Subtracts specified time units from a date.
|
|
385
385
|
|
|
@@ -390,8 +390,8 @@ Subtracts specified time units from a date.
|
|
|
390
390
|
```typescript
|
|
391
391
|
const date = new Date("2024-03-31T12:00:00Z");
|
|
392
392
|
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
subtract(date, { days: 5 }); // 2024-03-26T12:00:00.000Z
|
|
394
|
+
subtract(date, { months: 1 }); // 2024-02-29T12:00:00.000Z (handles month overflow)
|
|
395
395
|
```
|
|
396
396
|
|
|
397
397
|
#### `getUnit(date, unit)`
|
|
@@ -682,7 +682,7 @@ clampDate(new Date("2024-05-15"), min, max); // June 1 (clamped to min)
|
|
|
682
682
|
clampDate(new Date("2024-07-15"), min, max); // June 30 (clamped to max)
|
|
683
683
|
```
|
|
684
684
|
|
|
685
|
-
#### `
|
|
685
|
+
#### `datesUntil(start, end, step?)`
|
|
686
686
|
|
|
687
687
|
Generates an array of dates between start and end dates with a specified step.
|
|
688
688
|
|
|
@@ -709,29 +709,29 @@ const start = new Date("2024-01-01");
|
|
|
709
709
|
const end = new Date("2024-01-05");
|
|
710
710
|
|
|
711
711
|
// Daily range (default)
|
|
712
|
-
|
|
712
|
+
datesUntil(start, end);
|
|
713
713
|
// [2024-01-01, 2024-01-02, 2024-01-03, 2024-01-04, 2024-01-05]
|
|
714
714
|
|
|
715
|
-
// Chainable: chronal("2024-01-01").
|
|
715
|
+
// Chainable: chronal("2024-01-01").until(new Date("2024-01-05"))
|
|
716
716
|
|
|
717
717
|
// Weekly range
|
|
718
718
|
const weekEnd = new Date("2024-01-31");
|
|
719
|
-
|
|
719
|
+
datesUntil(start, weekEnd, { weeks: 1 });
|
|
720
720
|
// [2024-01-01, 2024-01-08, 2024-01-15, 2024-01-22, 2024-01-29]
|
|
721
721
|
|
|
722
|
-
// Chainable: chronal(start).
|
|
722
|
+
// Chainable: chronal(start).until(weekEnd, { weeks: 1 })
|
|
723
723
|
|
|
724
724
|
// Monthly range
|
|
725
725
|
const monthEnd = new Date("2024-06-15");
|
|
726
|
-
|
|
726
|
+
datesUntil(new Date("2024-01-15"), monthEnd, { months: 1 });
|
|
727
727
|
// [2024-01-15, 2024-02-15, 2024-03-15, 2024-04-15, 2024-05-15, 2024-06-15]
|
|
728
728
|
|
|
729
729
|
// Every 3 days
|
|
730
|
-
|
|
730
|
+
datesUntil(start, new Date("2024-01-10"), { days: 3 });
|
|
731
731
|
// [2024-01-01, 2024-01-04, 2024-01-07, 2024-01-10]
|
|
732
732
|
|
|
733
733
|
// Hourly range
|
|
734
|
-
|
|
734
|
+
datesUntil(
|
|
735
735
|
new Date("2024-01-01T09:00:00Z"),
|
|
736
736
|
new Date("2024-01-01T17:00:00Z"),
|
|
737
737
|
{ hours: 2 },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { add } from "./add.js";
|
|
2
|
-
import {
|
|
2
|
+
import { subtract } from "./subtract.js";
|
|
3
3
|
import { format } from "./format.js";
|
|
4
4
|
import { startOf } from "./start-of.js";
|
|
5
5
|
import { endOf } from "./end-of.js";
|
|
@@ -22,7 +22,8 @@ import { getQuarter } from "./get-quarter.js";
|
|
|
22
22
|
import { daysInMonth } from "./days-in-month.js";
|
|
23
23
|
import { weekOfYear } from "./week-of-year.js";
|
|
24
24
|
import { clamp } from "./clamp.js";
|
|
25
|
-
import {
|
|
25
|
+
import { until } from "./dates-until.js";
|
|
26
|
+
import { setChronalConfig } from "../lib/config.js";
|
|
26
27
|
/**
|
|
27
28
|
* Chronal object that wraps a Date and provides chainable date manipulation methods.
|
|
28
29
|
* Similar to Day.js API but built on native Date objects with immutable operations.
|
|
@@ -33,7 +34,7 @@ export type Chronal = {
|
|
|
33
34
|
/** Adds time units to this date */
|
|
34
35
|
add: typeof add;
|
|
35
36
|
/** Subtracts time units from this date */
|
|
36
|
-
|
|
37
|
+
subtract: typeof subtract;
|
|
37
38
|
/** Returns the start of a time unit */
|
|
38
39
|
startOf: typeof startOf;
|
|
39
40
|
/** Returns the end of a time unit */
|
|
@@ -79,7 +80,7 @@ export type Chronal = {
|
|
|
79
80
|
/** Gets the week number of the year */
|
|
80
81
|
week: typeof weekOfYear;
|
|
81
82
|
/** Generates an array of dates between this date and end date */
|
|
82
|
-
|
|
83
|
+
until: typeof until;
|
|
83
84
|
};
|
|
84
85
|
/**
|
|
85
86
|
* Creates a Chronal object with chainable date manipulation methods.
|
|
@@ -106,5 +107,10 @@ export type Chronal = {
|
|
|
106
107
|
* .format('YYYY-MM-DD'); // '2024-03-25'
|
|
107
108
|
* ```
|
|
108
109
|
*/
|
|
109
|
-
|
|
110
|
+
type ChronalFactory = {
|
|
111
|
+
(date?: Date | string | number | null): Chronal;
|
|
112
|
+
config: typeof setChronalConfig;
|
|
113
|
+
};
|
|
114
|
+
export declare const chronal: ChronalFactory;
|
|
115
|
+
export {};
|
|
110
116
|
//# sourceMappingURL=chronal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chronal.d.ts","sourceRoot":"","sources":["../../src/chainable/chronal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chronal.d.ts","sourceRoot":"","sources":["../../src/chainable/chronal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,C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UAAU,CAAC;IAGxB,iEAAiE;IACjE,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,KAAK,cAAc,GAAG;IACpB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IAChD,MAAM,EAAE,OAAO,gBAAgB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,cAiGrB,CAAC"}
|
package/esm/chainable/chronal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { add } from "./add.js";
|
|
2
|
-
import {
|
|
2
|
+
import { subtract } from "./subtract.js";
|
|
3
3
|
import { format } from "./format.js";
|
|
4
4
|
import { startOf } from "./start-of.js";
|
|
5
5
|
import { endOf } from "./end-of.js";
|
|
@@ -22,33 +22,9 @@ import { getQuarter } from "./get-quarter.js";
|
|
|
22
22
|
import { daysInMonth } from "./days-in-month.js";
|
|
23
23
|
import { weekOfYear } from "./week-of-year.js";
|
|
24
24
|
import { clamp } from "./clamp.js";
|
|
25
|
-
import {
|
|
25
|
+
import { until } from "./dates-until.js";
|
|
26
26
|
import { parseDate } from "../lib/parse-date.js";
|
|
27
|
-
|
|
28
|
-
* Creates a Chronal object with chainable date manipulation methods.
|
|
29
|
-
* All methods return new instances, preserving immutability.
|
|
30
|
-
*
|
|
31
|
-
* @param date - Optional Date, string, or timestamp. Defaults to current date/time
|
|
32
|
-
* @returns A Chronal object with the date and chainable methods
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* // Create from current time
|
|
37
|
-
* const now = chronal();
|
|
38
|
-
*
|
|
39
|
-
* // Create from Date
|
|
40
|
-
* const c = chronal(new Date('2024-06-15'));
|
|
41
|
-
*
|
|
42
|
-
* // Create from string (respects config.timezone)
|
|
43
|
-
* const c2 = chronal('2024-06-15T12:00:00Z');
|
|
44
|
-
*
|
|
45
|
-
* // Chain operations
|
|
46
|
-
* chronal('2024-01-15')
|
|
47
|
-
* .add({ months: 2, days: 10 })
|
|
48
|
-
* .startOf('day')
|
|
49
|
-
* .format('YYYY-MM-DD'); // '2024-03-25'
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
27
|
+
import { setChronalConfig } from "../lib/config.js";
|
|
52
28
|
export const chronal = (date) => {
|
|
53
29
|
let d;
|
|
54
30
|
if (date === null || date === undefined) {
|
|
@@ -67,8 +43,8 @@ export const chronal = (date) => {
|
|
|
67
43
|
add: function (opt) {
|
|
68
44
|
return add.call(this, opt);
|
|
69
45
|
},
|
|
70
|
-
|
|
71
|
-
return
|
|
46
|
+
subtract: function (opt) {
|
|
47
|
+
return subtract.call(this, opt);
|
|
72
48
|
},
|
|
73
49
|
startOf: function (unit) {
|
|
74
50
|
return startOf.call(this, unit);
|
|
@@ -140,8 +116,9 @@ export const chronal = (date) => {
|
|
|
140
116
|
return weekOfYear.call(this);
|
|
141
117
|
},
|
|
142
118
|
// Utilities
|
|
143
|
-
|
|
144
|
-
return
|
|
119
|
+
until: function (end, step) {
|
|
120
|
+
return until.call(this, end, step);
|
|
145
121
|
},
|
|
146
122
|
};
|
|
147
123
|
};
|
|
124
|
+
chronal.config = setChronalConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { datesUntil as _datesUntil } from "../lib/dates-until.js";
|
|
2
2
|
import { type Chronal } from "./chronal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Generates an array of Chronal objects between this date and an end date with a specified step.
|
|
@@ -12,12 +12,12 @@ import { type Chronal } from "./chronal.js";
|
|
|
12
12
|
* const start = chronal("2024-01-01");
|
|
13
13
|
* const end = new Date("2024-01-05");
|
|
14
14
|
*
|
|
15
|
-
* start.
|
|
16
|
-
* start.
|
|
15
|
+
* start.until(end); // Array of 5 Chronal objects (Jan 1-5)
|
|
16
|
+
* start.until(end, { days: 2 }); // Array of 3 Chronal objects (Jan 1, 3, 5)
|
|
17
17
|
*
|
|
18
18
|
* // Weekly range
|
|
19
|
-
* chronal("2024-01-01").
|
|
19
|
+
* chronal("2024-01-01").until(new Date("2024-01-31"), { weeks: 1 });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export declare function
|
|
23
|
-
//# sourceMappingURL=
|
|
22
|
+
export declare function until(this: Chronal, end: Date | Chronal, step?: Parameters<typeof _datesUntil>[2]): Chronal[];
|
|
23
|
+
//# sourceMappingURL=dates-until.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates-until.d.ts","sourceRoot":"","sources":["../../src/chainable/dates-until.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,IAAI,GAAG,OAAO,EACnB,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,GACvC,OAAO,EAAE,CAIX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { datesUntil as _datesUntil } from "../lib/dates-until.js";
|
|
2
2
|
import { chronal } from "./chronal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Generates an array of Chronal objects between this date and an end date with a specified step.
|
|
@@ -12,15 +12,15 @@ import { chronal } from "./chronal.js";
|
|
|
12
12
|
* const start = chronal("2024-01-01");
|
|
13
13
|
* const end = new Date("2024-01-05");
|
|
14
14
|
*
|
|
15
|
-
* start.
|
|
16
|
-
* start.
|
|
15
|
+
* start.until(end); // Array of 5 Chronal objects (Jan 1-5)
|
|
16
|
+
* start.until(end, { days: 2 }); // Array of 3 Chronal objects (Jan 1, 3, 5)
|
|
17
17
|
*
|
|
18
18
|
* // Weekly range
|
|
19
|
-
* chronal("2024-01-01").
|
|
19
|
+
* chronal("2024-01-01").until(new Date("2024-01-31"), { weeks: 1 });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export function
|
|
22
|
+
export function until(end, step) {
|
|
23
23
|
const endDate = end instanceof Date ? end : end.date;
|
|
24
|
-
const dates =
|
|
24
|
+
const dates = _datesUntil(this.date, endDate, step);
|
|
25
25
|
return dates.map((date) => chronal(date));
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/chainable/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/chainable/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,EAClC,GAAG,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GACjC,OAAO,CAOT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subtractTime as _subtract } from "../lib/subtract-time.js";
|
|
2
2
|
import { type Chronal } from "./chronal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Subtracts specified time units from the date.
|
|
@@ -8,8 +8,8 @@ import { type Chronal } from "./chronal.js";
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
10
|
* const c = chronal('2024-03-31T12:00:00Z');
|
|
11
|
-
* c.
|
|
11
|
+
* c.subtract({ years: 1, months: 1 }); // '2023-02-28T12:00:00.000Z'
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
15
|
-
//# sourceMappingURL=
|
|
14
|
+
export declare function subtract(this: Chronal, opt: Parameters<typeof _subtract>[1]): Chronal;
|
|
15
|
+
//# sourceMappingURL=subtract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtract.d.ts","sourceRoot":"","sources":["../../src/chainable/subtract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GACnC,OAAO,CAGT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subtractTime as _subtract } from "../lib/subtract-time.js";
|
|
2
2
|
import { chronal } from "./chronal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Subtracts specified time units from the date.
|
|
@@ -8,10 +8,10 @@ import { chronal } from "./chronal.js";
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
10
|
* const c = chronal('2024-03-31T12:00:00Z');
|
|
11
|
-
* c.
|
|
11
|
+
* c.subtract({ years: 1, months: 1 }); // '2023-02-28T12:00:00.000Z'
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export function
|
|
15
|
-
const newDate =
|
|
14
|
+
export function subtract(opt) {
|
|
15
|
+
const newDate = _subtract(this.date, opt);
|
|
16
16
|
return chronal(newDate);
|
|
17
17
|
}
|
package/esm/lib/config.d.ts
CHANGED
package/esm/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAGpB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAGpB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAQlD"}
|
package/esm/lib/config.js
CHANGED
|
@@ -21,15 +21,15 @@ type RangeStep = {
|
|
|
21
21
|
* const start = new Date("2024-01-01");
|
|
22
22
|
* const end = new Date("2024-01-05");
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* datesUntil(start, end); // Array of 5 dates (Jan 1-5)
|
|
25
|
+
* datesUntil(start, end, { days: 2 }); // Array of 3 dates (Jan 1, 3, 5)
|
|
26
26
|
*
|
|
27
27
|
* // Weekly range
|
|
28
28
|
* const weekStart = new Date("2024-01-01");
|
|
29
29
|
* const weekEnd = new Date("2024-01-31");
|
|
30
|
-
*
|
|
30
|
+
* datesUntil(weekStart, weekEnd, { weeks: 1 }); // Array of 5 dates (every Monday)
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function datesUntil(start: Date, end: Date, step?: RangeStep): Date[];
|
|
34
34
|
export {};
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=dates-until.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates-until.d.ts","sourceRoot":"","sources":["../../src/lib/dates-until.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,IAAI,GAAE,SAAuB,GAC5B,IAAI,EAAE,CAuFR"}
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
* const start = new Date("2024-01-01");
|
|
12
12
|
* const end = new Date("2024-01-05");
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* datesUntil(start, end); // Array of 5 dates (Jan 1-5)
|
|
15
|
+
* datesUntil(start, end, { days: 2 }); // Array of 3 dates (Jan 1, 3, 5)
|
|
16
16
|
*
|
|
17
17
|
* // Weekly range
|
|
18
18
|
* const weekStart = new Date("2024-01-01");
|
|
19
19
|
* const weekEnd = new Date("2024-01-31");
|
|
20
|
-
*
|
|
20
|
+
* datesUntil(weekStart, weekEnd, { weeks: 1 }); // Array of 5 dates (every Monday)
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
23
|
+
export function datesUntil(start, end, step = { days: 1 }) {
|
|
24
24
|
const result = [];
|
|
25
25
|
const startTime = start.getTime();
|
|
26
26
|
const endTime = end.getTime();
|
package/esm/lib/end-of.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/lib/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,KAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,
|
|
1
|
+
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/lib/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,KAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AACF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAAE,YAAiB,GAAG,IAAI,CAwG1E"}
|
package/esm/lib/end-of.js
CHANGED
|
@@ -64,16 +64,6 @@ export function endOf(date, unit, opt = {}) {
|
|
|
64
64
|
return time;
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
// Timezone-aware: get start of next unit and subtract 1ms
|
|
68
|
-
const unitMap = {
|
|
69
|
-
"second": "second",
|
|
70
|
-
"minute": "minute",
|
|
71
|
-
"hour": "hour",
|
|
72
|
-
"day": "day",
|
|
73
|
-
"week": "week",
|
|
74
|
-
"month": "month",
|
|
75
|
-
"year": "year",
|
|
76
|
-
};
|
|
77
67
|
// Get the start of the current unit
|
|
78
68
|
const start = startOf(date, unit, { tz: timezone });
|
|
79
69
|
// Calculate the next unit boundary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-of.d.ts","sourceRoot":"","sources":["../../src/lib/start-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,KAAK,cAAc,GAAG;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,
|
|
1
|
+
{"version":3,"file":"start-of.d.ts","sourceRoot":"","sources":["../../src/lib/start-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,KAAK,cAAc,GAAG;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,OAAO,CACrB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,GAAG,GAAE,cAAmB,GACvB,IAAI,CA8JN"}
|
package/esm/lib/start-of.js
CHANGED
|
@@ -128,14 +128,16 @@ export function startOf(date, unit, opt = {}) {
|
|
|
128
128
|
const mid = Math.floor((low + high) / 2);
|
|
129
129
|
const midDate = new Date(mid);
|
|
130
130
|
const midParts = formatter.formatToParts(midDate);
|
|
131
|
-
const midYear = parseInt(midParts.find(p => p.type === "year")?.value || "0");
|
|
132
|
-
const midMonth = parseInt(midParts.find(p => p.type === "month")?.value || "0");
|
|
133
|
-
const midDay = parseInt(midParts.find(p => p.type === "day")?.value || "0");
|
|
134
|
-
const midHour = parseInt(midParts.find(p => p.type === "hour")?.value || "0");
|
|
135
|
-
const midMinute = parseInt(midParts.find(p => p.type === "minute")?.value || "0");
|
|
136
|
-
const midSecond = parseInt(midParts.find(p => p.type === "second")?.value || "0");
|
|
137
|
-
const midTime = midYear * 1e10 + midMonth * 1e8 + midDay * 1e6 +
|
|
138
|
-
|
|
131
|
+
const midYear = parseInt(midParts.find((p) => p.type === "year")?.value || "0");
|
|
132
|
+
const midMonth = parseInt(midParts.find((p) => p.type === "month")?.value || "0");
|
|
133
|
+
const midDay = parseInt(midParts.find((p) => p.type === "day")?.value || "0");
|
|
134
|
+
const midHour = parseInt(midParts.find((p) => p.type === "hour")?.value || "0");
|
|
135
|
+
const midMinute = parseInt(midParts.find((p) => p.type === "minute")?.value || "0");
|
|
136
|
+
const midSecond = parseInt(midParts.find((p) => p.type === "second")?.value || "0");
|
|
137
|
+
const midTime = midYear * 1e10 + midMonth * 1e8 + midDay * 1e6 +
|
|
138
|
+
midHour * 1e4 + midMinute * 100 + midSecond;
|
|
139
|
+
const targetTime = year * 1e10 + month * 1e8 + day * 1e6 + hour * 1e4 +
|
|
140
|
+
minute * 100 + second;
|
|
139
141
|
if (midTime < targetTime) {
|
|
140
142
|
low = mid;
|
|
141
143
|
}
|
|
@@ -16,9 +16,9 @@ type SubOptions = {
|
|
|
16
16
|
* @returns A new Date object with the specified time units subtracted.
|
|
17
17
|
* @example
|
|
18
18
|
* const date = new Date('2024-03-31T12:00:00Z');
|
|
19
|
-
* const newDate =
|
|
19
|
+
* const newDate = subtract(date, { years: 1, months: 1 });
|
|
20
20
|
* console.log(newDate.toISOString()); // '2023-02-28T12:00:00.000Z'
|
|
21
21
|
*/
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function subtractTime(date: Date, opt: SubOptions): Date;
|
|
23
23
|
export {};
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=subtract-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtract-time.d.ts","sourceRoot":"","sources":["../../src/lib/subtract-time.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAa9D"}
|
|
@@ -7,10 +7,10 @@ import { addTime } from "./add-time.js";
|
|
|
7
7
|
* @returns A new Date object with the specified time units subtracted.
|
|
8
8
|
* @example
|
|
9
9
|
* const date = new Date('2024-03-31T12:00:00Z');
|
|
10
|
-
* const newDate =
|
|
10
|
+
* const newDate = subtract(date, { years: 1, months: 1 });
|
|
11
11
|
* console.log(newDate.toISOString()); // '2023-02-28T12:00:00.000Z'
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function subtractTime(date, opt) {
|
|
14
14
|
const out = {};
|
|
15
15
|
if (opt.years)
|
|
16
16
|
out.years = -opt.years;
|
package/esm/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { addTime } from "./lib/add-time.js";
|
|
2
|
-
export {
|
|
2
|
+
export { subtractTime } from "./lib/subtract-time.js";
|
|
3
3
|
export { getUnit } from "./lib/get-unit.js";
|
|
4
4
|
export { setUnit } from "./lib/set-unit.js";
|
|
5
5
|
export { months } from "./lib/months.js";
|
|
@@ -28,9 +28,9 @@ export { closestTo } from "./lib/closest-to.js";
|
|
|
28
28
|
export { clampDate } from "./lib/clamp-date.js";
|
|
29
29
|
export { fromNow } from "./lib/from-now.js";
|
|
30
30
|
export { toNow } from "./lib/to-now.js";
|
|
31
|
-
export {
|
|
31
|
+
export { datesUntil } from "./lib/dates-until.js";
|
|
32
32
|
export type { PluralUnit, Unit } from "./types/unit.js";
|
|
33
|
-
export {
|
|
33
|
+
export { setChronalConfig } from "./lib/config.js";
|
|
34
34
|
export { chronal } from "./chainable/chronal.js";
|
|
35
35
|
export type { Chronal } from "./chainable/chronal.js";
|
|
36
36
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","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O,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { addTime } from "./lib/add-time.js";
|
|
2
|
-
export {
|
|
2
|
+
export { subtractTime } from "./lib/subtract-time.js";
|
|
3
3
|
export { getUnit } from "./lib/get-unit.js";
|
|
4
4
|
export { setUnit } from "./lib/set-unit.js";
|
|
5
5
|
export { months } from "./lib/months.js";
|
|
@@ -28,6 +28,6 @@ export { closestTo } from "./lib/closest-to.js";
|
|
|
28
28
|
export { clampDate } from "./lib/clamp-date.js";
|
|
29
29
|
export { fromNow } from "./lib/from-now.js";
|
|
30
30
|
export { toNow } from "./lib/to-now.js";
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
31
|
+
export { datesUntil } from "./lib/dates-until.js";
|
|
32
|
+
export { setChronalConfig } from "./lib/config.js";
|
|
33
33
|
export { chronal } from "./chainable/chronal.js";
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { add } from "./add.js";
|
|
2
|
-
import {
|
|
2
|
+
import { subtract } from "./subtract.js";
|
|
3
3
|
import { format } from "./format.js";
|
|
4
4
|
import { startOf } from "./start-of.js";
|
|
5
5
|
import { endOf } from "./end-of.js";
|
|
@@ -22,7 +22,8 @@ import { getQuarter } from "./get-quarter.js";
|
|
|
22
22
|
import { daysInMonth } from "./days-in-month.js";
|
|
23
23
|
import { weekOfYear } from "./week-of-year.js";
|
|
24
24
|
import { clamp } from "./clamp.js";
|
|
25
|
-
import {
|
|
25
|
+
import { until } from "./dates-until.js";
|
|
26
|
+
import { setChronalConfig } from "../lib/config.js";
|
|
26
27
|
/**
|
|
27
28
|
* Chronal object that wraps a Date and provides chainable date manipulation methods.
|
|
28
29
|
* Similar to Day.js API but built on native Date objects with immutable operations.
|
|
@@ -33,7 +34,7 @@ export type Chronal = {
|
|
|
33
34
|
/** Adds time units to this date */
|
|
34
35
|
add: typeof add;
|
|
35
36
|
/** Subtracts time units from this date */
|
|
36
|
-
|
|
37
|
+
subtract: typeof subtract;
|
|
37
38
|
/** Returns the start of a time unit */
|
|
38
39
|
startOf: typeof startOf;
|
|
39
40
|
/** Returns the end of a time unit */
|
|
@@ -79,7 +80,7 @@ export type Chronal = {
|
|
|
79
80
|
/** Gets the week number of the year */
|
|
80
81
|
week: typeof weekOfYear;
|
|
81
82
|
/** Generates an array of dates between this date and end date */
|
|
82
|
-
|
|
83
|
+
until: typeof until;
|
|
83
84
|
};
|
|
84
85
|
/**
|
|
85
86
|
* Creates a Chronal object with chainable date manipulation methods.
|
|
@@ -106,5 +107,10 @@ export type Chronal = {
|
|
|
106
107
|
* .format('YYYY-MM-DD'); // '2024-03-25'
|
|
107
108
|
* ```
|
|
108
109
|
*/
|
|
109
|
-
|
|
110
|
+
type ChronalFactory = {
|
|
111
|
+
(date?: Date | string | number | null): Chronal;
|
|
112
|
+
config: typeof setChronalConfig;
|
|
113
|
+
};
|
|
114
|
+
export declare const chronal: ChronalFactory;
|
|
115
|
+
export {};
|
|
110
116
|
//# sourceMappingURL=chronal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chronal.d.ts","sourceRoot":"","sources":["../../src/chainable/chronal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chronal.d.ts","sourceRoot":"","sources":["../../src/chainable/chronal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EA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,EAAE,OAAO,OAAO,CAAC;IACxB,iCAAiC;IACjC,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,kCAAkC;IAClC,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,oCAAoC;IACpC,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,8BAA8B;IAC9B,OAAO,EAAE,OAAO,OAAO,CAAC;IAGxB,sCAAsC;IACtC,GAAG,EAAE,OAAO,OAAO,CAAC;IACpB,yCAAyC;IACzC,OAAO,EAAE,OAAO,UAAU,CAAC;IAC3B,2CAA2C;IAC3C,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,uCAAuC;IACvC,IAAI,EAAE,OAAO,UAAU,CAAC;IAGxB,iEAAiE;IACjE,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,KAAK,cAAc,GAAG;IACpB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IAChD,MAAM,EAAE,OAAO,gBAAgB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,cAiGrB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.chronal = void 0;
|
|
4
4
|
const add_js_1 = require("./add.js");
|
|
5
|
-
const
|
|
5
|
+
const subtract_js_1 = require("./subtract.js");
|
|
6
6
|
const format_js_1 = require("./format.js");
|
|
7
7
|
const start_of_js_1 = require("./start-of.js");
|
|
8
8
|
const end_of_js_1 = require("./end-of.js");
|
|
@@ -25,33 +25,9 @@ const get_quarter_js_1 = require("./get-quarter.js");
|
|
|
25
25
|
const days_in_month_js_1 = require("./days-in-month.js");
|
|
26
26
|
const week_of_year_js_1 = require("./week-of-year.js");
|
|
27
27
|
const clamp_js_1 = require("./clamp.js");
|
|
28
|
-
const
|
|
28
|
+
const dates_until_js_1 = require("./dates-until.js");
|
|
29
29
|
const parse_date_js_1 = require("../lib/parse-date.js");
|
|
30
|
-
|
|
31
|
-
* Creates a Chronal object with chainable date manipulation methods.
|
|
32
|
-
* All methods return new instances, preserving immutability.
|
|
33
|
-
*
|
|
34
|
-
* @param date - Optional Date, string, or timestamp. Defaults to current date/time
|
|
35
|
-
* @returns A Chronal object with the date and chainable methods
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* // Create from current time
|
|
40
|
-
* const now = chronal();
|
|
41
|
-
*
|
|
42
|
-
* // Create from Date
|
|
43
|
-
* const c = chronal(new Date('2024-06-15'));
|
|
44
|
-
*
|
|
45
|
-
* // Create from string (respects config.timezone)
|
|
46
|
-
* const c2 = chronal('2024-06-15T12:00:00Z');
|
|
47
|
-
*
|
|
48
|
-
* // Chain operations
|
|
49
|
-
* chronal('2024-01-15')
|
|
50
|
-
* .add({ months: 2, days: 10 })
|
|
51
|
-
* .startOf('day')
|
|
52
|
-
* .format('YYYY-MM-DD'); // '2024-03-25'
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
30
|
+
const config_js_1 = require("../lib/config.js");
|
|
55
31
|
const chronal = (date) => {
|
|
56
32
|
let d;
|
|
57
33
|
if (date === null || date === undefined) {
|
|
@@ -70,8 +46,8 @@ const chronal = (date) => {
|
|
|
70
46
|
add: function (opt) {
|
|
71
47
|
return add_js_1.add.call(this, opt);
|
|
72
48
|
},
|
|
73
|
-
|
|
74
|
-
return
|
|
49
|
+
subtract: function (opt) {
|
|
50
|
+
return subtract_js_1.subtract.call(this, opt);
|
|
75
51
|
},
|
|
76
52
|
startOf: function (unit) {
|
|
77
53
|
return start_of_js_1.startOf.call(this, unit);
|
|
@@ -143,9 +119,10 @@ const chronal = (date) => {
|
|
|
143
119
|
return week_of_year_js_1.weekOfYear.call(this);
|
|
144
120
|
},
|
|
145
121
|
// Utilities
|
|
146
|
-
|
|
147
|
-
return
|
|
122
|
+
until: function (end, step) {
|
|
123
|
+
return dates_until_js_1.until.call(this, end, step);
|
|
148
124
|
},
|
|
149
125
|
};
|
|
150
126
|
};
|
|
151
127
|
exports.chronal = chronal;
|
|
128
|
+
exports.chronal.config = config_js_1.setChronalConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { datesUntil as _datesUntil } from "../lib/dates-until.js";
|
|
2
2
|
import { type Chronal } from "./chronal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Generates an array of Chronal objects between this date and an end date with a specified step.
|
|
@@ -12,12 +12,12 @@ import { type Chronal } from "./chronal.js";
|
|
|
12
12
|
* const start = chronal("2024-01-01");
|
|
13
13
|
* const end = new Date("2024-01-05");
|
|
14
14
|
*
|
|
15
|
-
* start.
|
|
16
|
-
* start.
|
|
15
|
+
* start.until(end); // Array of 5 Chronal objects (Jan 1-5)
|
|
16
|
+
* start.until(end, { days: 2 }); // Array of 3 Chronal objects (Jan 1, 3, 5)
|
|
17
17
|
*
|
|
18
18
|
* // Weekly range
|
|
19
|
-
* chronal("2024-01-01").
|
|
19
|
+
* chronal("2024-01-01").until(new Date("2024-01-31"), { weeks: 1 });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export declare function
|
|
23
|
-
//# sourceMappingURL=
|
|
22
|
+
export declare function until(this: Chronal, end: Date | Chronal, step?: Parameters<typeof _datesUntil>[2]): Chronal[];
|
|
23
|
+
//# sourceMappingURL=dates-until.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates-until.d.ts","sourceRoot":"","sources":["../../src/chainable/dates-until.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,IAAI,GAAG,OAAO,EACnB,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,GACvC,OAAO,EAAE,CAIX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.until = until;
|
|
4
|
+
const dates_until_js_1 = require("../lib/dates-until.js");
|
|
5
5
|
const chronal_js_1 = require("./chronal.js");
|
|
6
6
|
/**
|
|
7
7
|
* Generates an array of Chronal objects between this date and an end date with a specified step.
|
|
@@ -15,15 +15,15 @@ const chronal_js_1 = require("./chronal.js");
|
|
|
15
15
|
* const start = chronal("2024-01-01");
|
|
16
16
|
* const end = new Date("2024-01-05");
|
|
17
17
|
*
|
|
18
|
-
* start.
|
|
19
|
-
* start.
|
|
18
|
+
* start.until(end); // Array of 5 Chronal objects (Jan 1-5)
|
|
19
|
+
* start.until(end, { days: 2 }); // Array of 3 Chronal objects (Jan 1, 3, 5)
|
|
20
20
|
*
|
|
21
21
|
* // Weekly range
|
|
22
|
-
* chronal("2024-01-01").
|
|
22
|
+
* chronal("2024-01-01").until(new Date("2024-01-31"), { weeks: 1 });
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
function
|
|
25
|
+
function until(end, step) {
|
|
26
26
|
const endDate = end instanceof Date ? end : end.date;
|
|
27
|
-
const dates = (0,
|
|
27
|
+
const dates = (0, dates_until_js_1.datesUntil)(this.date, endDate, step);
|
|
28
28
|
return dates.map((date) => (0, chronal_js_1.chronal)(date));
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/chainable/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/chainable/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,EAClC,GAAG,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GACjC,OAAO,CAOT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subtractTime as _subtract } from "../lib/subtract-time.js";
|
|
2
2
|
import { type Chronal } from "./chronal.js";
|
|
3
3
|
/**
|
|
4
4
|
* Subtracts specified time units from the date.
|
|
@@ -8,8 +8,8 @@ import { type Chronal } from "./chronal.js";
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
10
|
* const c = chronal('2024-03-31T12:00:00Z');
|
|
11
|
-
* c.
|
|
11
|
+
* c.subtract({ years: 1, months: 1 }); // '2023-02-28T12:00:00.000Z'
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
15
|
-
//# sourceMappingURL=
|
|
14
|
+
export declare function subtract(this: Chronal, opt: Parameters<typeof _subtract>[1]): Chronal;
|
|
15
|
+
//# sourceMappingURL=subtract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtract.d.ts","sourceRoot":"","sources":["../../src/chainable/subtract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GACnC,OAAO,CAGT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.subtract = subtract;
|
|
4
|
+
const subtract_time_js_1 = require("../lib/subtract-time.js");
|
|
5
5
|
const chronal_js_1 = require("./chronal.js");
|
|
6
6
|
/**
|
|
7
7
|
* Subtracts specified time units from the date.
|
|
@@ -11,10 +11,10 @@ const chronal_js_1 = require("./chronal.js");
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const c = chronal('2024-03-31T12:00:00Z');
|
|
14
|
-
* c.
|
|
14
|
+
* c.subtract({ years: 1, months: 1 }); // '2023-02-28T12:00:00.000Z'
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
function
|
|
18
|
-
const newDate = (0,
|
|
17
|
+
function subtract(opt) {
|
|
18
|
+
const newDate = (0, subtract_time_js_1.subtractTime)(this.date, opt);
|
|
19
19
|
return (0, chronal_js_1.chronal)(newDate);
|
|
20
20
|
}
|
package/script/lib/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAGpB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAGpB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAQlD"}
|
package/script/lib/config.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.config = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.setChronalConfig = setChronalConfig;
|
|
5
5
|
const DEFAULT_LOCALE = "en-US";
|
|
6
6
|
const DEFAULT_TZ = "UTC";
|
|
7
7
|
exports.config = {
|
|
8
8
|
locale: DEFAULT_LOCALE,
|
|
9
9
|
timezone: DEFAULT_TZ,
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function setChronalConfig(c) {
|
|
12
12
|
if (c.locale) {
|
|
13
13
|
exports.config.locale = c.locale;
|
|
14
14
|
}
|
|
@@ -21,15 +21,15 @@ type RangeStep = {
|
|
|
21
21
|
* const start = new Date("2024-01-01");
|
|
22
22
|
* const end = new Date("2024-01-05");
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* datesUntil(start, end); // Array of 5 dates (Jan 1-5)
|
|
25
|
+
* datesUntil(start, end, { days: 2 }); // Array of 3 dates (Jan 1, 3, 5)
|
|
26
26
|
*
|
|
27
27
|
* // Weekly range
|
|
28
28
|
* const weekStart = new Date("2024-01-01");
|
|
29
29
|
* const weekEnd = new Date("2024-01-31");
|
|
30
|
-
*
|
|
30
|
+
* datesUntil(weekStart, weekEnd, { weeks: 1 }); // Array of 5 dates (every Monday)
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function datesUntil(start: Date, end: Date, step?: RangeStep): Date[];
|
|
34
34
|
export {};
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=dates-until.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates-until.d.ts","sourceRoot":"","sources":["../../src/lib/dates-until.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,IAAI,GAAE,SAAuB,GAC5B,IAAI,EAAE,CAuFR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.datesUntil = datesUntil;
|
|
4
4
|
/**
|
|
5
5
|
* Generates an array of dates between start and end dates with a specified step.
|
|
6
6
|
*
|
|
@@ -14,16 +14,16 @@ exports.dateRange = dateRange;
|
|
|
14
14
|
* const start = new Date("2024-01-01");
|
|
15
15
|
* const end = new Date("2024-01-05");
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* datesUntil(start, end); // Array of 5 dates (Jan 1-5)
|
|
18
|
+
* datesUntil(start, end, { days: 2 }); // Array of 3 dates (Jan 1, 3, 5)
|
|
19
19
|
*
|
|
20
20
|
* // Weekly range
|
|
21
21
|
* const weekStart = new Date("2024-01-01");
|
|
22
22
|
* const weekEnd = new Date("2024-01-31");
|
|
23
|
-
*
|
|
23
|
+
* datesUntil(weekStart, weekEnd, { weeks: 1 }); // Array of 5 dates (every Monday)
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
function
|
|
26
|
+
function datesUntil(start, end, step = { days: 1 }) {
|
|
27
27
|
const result = [];
|
|
28
28
|
const startTime = start.getTime();
|
|
29
29
|
const endTime = end.getTime();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/lib/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,KAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,
|
|
1
|
+
{"version":3,"file":"end-of.d.ts","sourceRoot":"","sources":["../../src/lib/end-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,KAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AACF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAAE,YAAiB,GAAG,IAAI,CAwG1E"}
|
package/script/lib/end-of.js
CHANGED
|
@@ -67,16 +67,6 @@ function endOf(date, unit, opt = {}) {
|
|
|
67
67
|
return time;
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
|
-
// Timezone-aware: get start of next unit and subtract 1ms
|
|
71
|
-
const unitMap = {
|
|
72
|
-
"second": "second",
|
|
73
|
-
"minute": "minute",
|
|
74
|
-
"hour": "hour",
|
|
75
|
-
"day": "day",
|
|
76
|
-
"week": "week",
|
|
77
|
-
"month": "month",
|
|
78
|
-
"year": "year",
|
|
79
|
-
};
|
|
80
70
|
// Get the start of the current unit
|
|
81
71
|
const start = (0, start_of_js_1.startOf)(date, unit, { tz: timezone });
|
|
82
72
|
// Calculate the next unit boundary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-of.d.ts","sourceRoot":"","sources":["../../src/lib/start-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,KAAK,cAAc,GAAG;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,
|
|
1
|
+
{"version":3,"file":"start-of.d.ts","sourceRoot":"","sources":["../../src/lib/start-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,KAAK,cAAc,GAAG;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,OAAO,CACrB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,GAAG,GAAE,cAAmB,GACvB,IAAI,CA8JN"}
|
package/script/lib/start-of.js
CHANGED
|
@@ -131,14 +131,16 @@ function startOf(date, unit, opt = {}) {
|
|
|
131
131
|
const mid = Math.floor((low + high) / 2);
|
|
132
132
|
const midDate = new Date(mid);
|
|
133
133
|
const midParts = formatter.formatToParts(midDate);
|
|
134
|
-
const midYear = parseInt(midParts.find(p => p.type === "year")?.value || "0");
|
|
135
|
-
const midMonth = parseInt(midParts.find(p => p.type === "month")?.value || "0");
|
|
136
|
-
const midDay = parseInt(midParts.find(p => p.type === "day")?.value || "0");
|
|
137
|
-
const midHour = parseInt(midParts.find(p => p.type === "hour")?.value || "0");
|
|
138
|
-
const midMinute = parseInt(midParts.find(p => p.type === "minute")?.value || "0");
|
|
139
|
-
const midSecond = parseInt(midParts.find(p => p.type === "second")?.value || "0");
|
|
140
|
-
const midTime = midYear * 1e10 + midMonth * 1e8 + midDay * 1e6 +
|
|
141
|
-
|
|
134
|
+
const midYear = parseInt(midParts.find((p) => p.type === "year")?.value || "0");
|
|
135
|
+
const midMonth = parseInt(midParts.find((p) => p.type === "month")?.value || "0");
|
|
136
|
+
const midDay = parseInt(midParts.find((p) => p.type === "day")?.value || "0");
|
|
137
|
+
const midHour = parseInt(midParts.find((p) => p.type === "hour")?.value || "0");
|
|
138
|
+
const midMinute = parseInt(midParts.find((p) => p.type === "minute")?.value || "0");
|
|
139
|
+
const midSecond = parseInt(midParts.find((p) => p.type === "second")?.value || "0");
|
|
140
|
+
const midTime = midYear * 1e10 + midMonth * 1e8 + midDay * 1e6 +
|
|
141
|
+
midHour * 1e4 + midMinute * 100 + midSecond;
|
|
142
|
+
const targetTime = year * 1e10 + month * 1e8 + day * 1e6 + hour * 1e4 +
|
|
143
|
+
minute * 100 + second;
|
|
142
144
|
if (midTime < targetTime) {
|
|
143
145
|
low = mid;
|
|
144
146
|
}
|
|
@@ -16,9 +16,9 @@ type SubOptions = {
|
|
|
16
16
|
* @returns A new Date object with the specified time units subtracted.
|
|
17
17
|
* @example
|
|
18
18
|
* const date = new Date('2024-03-31T12:00:00Z');
|
|
19
|
-
* const newDate =
|
|
19
|
+
* const newDate = subtract(date, { years: 1, months: 1 });
|
|
20
20
|
* console.log(newDate.toISOString()); // '2023-02-28T12:00:00.000Z'
|
|
21
21
|
*/
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function subtractTime(date: Date, opt: SubOptions): Date;
|
|
23
23
|
export {};
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=subtract-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtract-time.d.ts","sourceRoot":"","sources":["../../src/lib/subtract-time.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAa9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.subtractTime = subtractTime;
|
|
4
4
|
const add_time_js_1 = require("./add-time.js");
|
|
5
5
|
/**
|
|
6
6
|
* Subtracts specified time units from the given date.
|
|
@@ -10,10 +10,10 @@ const add_time_js_1 = require("./add-time.js");
|
|
|
10
10
|
* @returns A new Date object with the specified time units subtracted.
|
|
11
11
|
* @example
|
|
12
12
|
* const date = new Date('2024-03-31T12:00:00Z');
|
|
13
|
-
* const newDate =
|
|
13
|
+
* const newDate = subtract(date, { years: 1, months: 1 });
|
|
14
14
|
* console.log(newDate.toISOString()); // '2023-02-28T12:00:00.000Z'
|
|
15
15
|
*/
|
|
16
|
-
function
|
|
16
|
+
function subtractTime(date, opt) {
|
|
17
17
|
const out = {};
|
|
18
18
|
if (opt.years)
|
|
19
19
|
out.years = -opt.years;
|
package/script/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { addTime } from "./lib/add-time.js";
|
|
2
|
-
export {
|
|
2
|
+
export { subtractTime } from "./lib/subtract-time.js";
|
|
3
3
|
export { getUnit } from "./lib/get-unit.js";
|
|
4
4
|
export { setUnit } from "./lib/set-unit.js";
|
|
5
5
|
export { months } from "./lib/months.js";
|
|
@@ -28,9 +28,9 @@ export { closestTo } from "./lib/closest-to.js";
|
|
|
28
28
|
export { clampDate } from "./lib/clamp-date.js";
|
|
29
29
|
export { fromNow } from "./lib/from-now.js";
|
|
30
30
|
export { toNow } from "./lib/to-now.js";
|
|
31
|
-
export {
|
|
31
|
+
export { datesUntil } from "./lib/dates-until.js";
|
|
32
32
|
export type { PluralUnit, Unit } from "./types/unit.js";
|
|
33
|
-
export {
|
|
33
|
+
export { setChronalConfig } from "./lib/config.js";
|
|
34
34
|
export { chronal } from "./chainable/chronal.js";
|
|
35
35
|
export type { Chronal } from "./chainable/chronal.js";
|
|
36
36
|
//# sourceMappingURL=mod.d.ts.map
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA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al = exports.setChronalConfig = exports.datesUntil = exports.toNow = exports.fromNow = exports.clampDate = exports.closestTo = exports.weekOfYear = exports.getQuarter = exports.daysInMonth = exports.dateDiff = exports.minDate = exports.maxDate = exports.isLeapYear = exports.isValidDate = exports.isYesterday = exports.isTomorrow = exports.isToday = exports.isBetween = exports.isSame = exports.isEqual = exports.isBefore = exports.isAfter = exports.weekdays = exports.parseDate = exports.formatDate = exports.endOf = exports.startOf = exports.months = exports.setUnit = exports.getUnit = exports.subtractTime = exports.addTime = void 0;
|
|
4
4
|
var add_time_js_1 = require("./lib/add-time.js");
|
|
5
5
|
Object.defineProperty(exports, "addTime", { enumerable: true, get: function () { return add_time_js_1.addTime; } });
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "
|
|
6
|
+
var subtract_time_js_1 = require("./lib/subtract-time.js");
|
|
7
|
+
Object.defineProperty(exports, "subtractTime", { enumerable: true, get: function () { return subtract_time_js_1.subtractTime; } });
|
|
8
8
|
var get_unit_js_1 = require("./lib/get-unit.js");
|
|
9
9
|
Object.defineProperty(exports, "getUnit", { enumerable: true, get: function () { return get_unit_js_1.getUnit; } });
|
|
10
10
|
var set_unit_js_1 = require("./lib/set-unit.js");
|
|
@@ -61,9 +61,9 @@ var from_now_js_1 = require("./lib/from-now.js");
|
|
|
61
61
|
Object.defineProperty(exports, "fromNow", { enumerable: true, get: function () { return from_now_js_1.fromNow; } });
|
|
62
62
|
var to_now_js_1 = require("./lib/to-now.js");
|
|
63
63
|
Object.defineProperty(exports, "toNow", { enumerable: true, get: function () { return to_now_js_1.toNow; } });
|
|
64
|
-
var
|
|
65
|
-
Object.defineProperty(exports, "
|
|
64
|
+
var dates_until_js_1 = require("./lib/dates-until.js");
|
|
65
|
+
Object.defineProperty(exports, "datesUntil", { enumerable: true, get: function () { return dates_until_js_1.datesUntil; } });
|
|
66
66
|
var config_js_1 = require("./lib/config.js");
|
|
67
|
-
Object.defineProperty(exports, "
|
|
67
|
+
Object.defineProperty(exports, "setChronalConfig", { enumerable: true, get: function () { return config_js_1.setChronalConfig; } });
|
|
68
68
|
var chronal_js_1 = require("./chainable/chronal.js");
|
|
69
69
|
Object.defineProperty(exports, "chronal", { enumerable: true, get: function () { return chronal_js_1.chronal; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/chainable/date-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,IAAI,GAAG,OAAO,EACnB,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,GACtC,OAAO,EAAE,CAIX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sub-time.d.ts","sourceRoot":"","sources":["../../src/chainable/sub-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,GAAG,CACjB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAClC,OAAO,CAGT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/lib/date-range.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,IAAI,GAAE,SAAuB,GAC5B,IAAI,EAAE,CAuFR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sub-time.d.ts","sourceRoot":"","sources":["../../src/lib/sub-time.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAazD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/chainable/date-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,IAAI,GAAG,OAAO,EACnB,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,GACtC,OAAO,EAAE,CAIX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sub-time.d.ts","sourceRoot":"","sources":["../../src/chainable/sub-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,GAAG,CACjB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAClC,OAAO,CAGT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/lib/date-range.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,IAAI,GAAE,SAAuB,GAC5B,IAAI,EAAE,CAuFR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sub-time.d.ts","sourceRoot":"","sources":["../../src/lib/sub-time.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAazD"}
|