@formkit/tempo 0.1.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addDay.d.ts +4 -3
- package/dist/addDay.mjs.map +1 -1
- package/dist/addHour.d.ts +4 -3
- package/dist/addHour.mjs.map +1 -1
- package/dist/addMillisecond.d.ts +10 -0
- package/dist/addMillisecond.mjs +11 -0
- package/dist/addMillisecond.mjs.map +1 -0
- package/dist/addMinute.d.ts +5 -4
- package/dist/addMinute.mjs.map +1 -1
- package/dist/addMonth.d.ts +5 -5
- package/dist/addMonth.mjs +1 -2
- package/dist/addMonth.mjs.map +1 -1
- package/dist/addSecond.d.ts +4 -3
- package/dist/addSecond.mjs.map +1 -1
- package/dist/addYear.d.ts +5 -5
- package/dist/addYear.mjs +1 -2
- package/dist/addYear.mjs.map +1 -1
- package/dist/ap.mjs +1 -2
- package/dist/ap.mjs.map +1 -1
- package/dist/applyOffset.d.ts +5 -5
- package/dist/applyOffset.mjs +5 -11
- package/dist/applyOffset.mjs.map +1 -1
- package/dist/bundle.d.ts +256 -115
- package/dist/bundle.mjs +158 -142
- package/dist/bundle.mjs.map +1 -1
- package/dist/common.d.ts +27 -7
- package/dist/common.mjs +47 -42
- package/dist/common.mjs.map +1 -1
- package/dist/date.d.ts +2 -2
- package/dist/date.mjs +1 -3
- package/dist/date.mjs.map +1 -1
- package/dist/dayEnd.d.ts +3 -3
- package/dist/dayEnd.mjs.map +1 -1
- package/dist/dayOfYear.d.ts +3 -3
- package/dist/dayOfYear.mjs.map +1 -1
- package/dist/dayStart.d.ts +3 -3
- package/dist/dayStart.mjs +1 -1
- package/dist/dayStart.mjs.map +1 -1
- package/dist/diffDays.d.ts +12 -5
- package/dist/diffDays.mjs +1 -0
- package/dist/diffDays.mjs.map +1 -1
- package/dist/diffHours.d.ts +12 -5
- package/dist/diffHours.mjs +1 -0
- package/dist/diffHours.mjs.map +1 -1
- package/dist/diffMilliseconds.d.ts +10 -4
- package/dist/diffMilliseconds.mjs.map +1 -1
- package/dist/diffMinutes.d.ts +11 -3
- package/dist/diffMinutes.mjs +5 -1
- package/dist/diffMinutes.mjs.map +1 -1
- package/dist/diffMonths.d.ts +10 -4
- package/dist/diffMonths.mjs.map +1 -1
- package/dist/diffSeconds.d.ts +12 -5
- package/dist/diffSeconds.mjs +5 -1
- package/dist/diffSeconds.mjs.map +1 -1
- package/dist/diffWeeks.d.ts +10 -3
- package/dist/diffWeeks.mjs.map +1 -1
- package/dist/diffYears.d.ts +10 -4
- package/dist/diffYears.mjs +4 -1
- package/dist/diffYears.mjs.map +1 -1
- package/dist/format.mjs +2 -3
- package/dist/format.mjs.map +1 -1
- package/dist/hourEnd.d.ts +3 -3
- package/dist/hourEnd.mjs.map +1 -1
- package/dist/hourStart.d.ts +3 -3
- package/dist/hourStart.mjs +1 -1
- package/dist/hourStart.mjs.map +1 -1
- package/dist/index.cjs +165 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +256 -115
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/isAfter.d.ts +6 -6
- package/dist/isAfter.mjs.map +1 -1
- package/dist/isBefore.d.ts +5 -5
- package/dist/isBefore.mjs.map +1 -1
- package/dist/isEqual.d.ts +13 -4
- package/dist/isEqual.mjs.map +1 -1
- package/dist/isFuture.d.ts +10 -0
- package/dist/isFuture.mjs +9 -0
- package/dist/isFuture.mjs.map +1 -0
- package/dist/isPast.d.ts +10 -0
- package/dist/isPast.mjs +9 -0
- package/dist/isPast.mjs.map +1 -0
- package/dist/iso8601.d.ts +1 -1
- package/dist/iso8601.mjs +4 -7
- package/dist/iso8601.mjs.map +1 -1
- package/dist/minuteEnd.d.ts +3 -3
- package/dist/minuteEnd.mjs.map +1 -1
- package/dist/minuteStart.d.ts +3 -3
- package/dist/minuteStart.mjs +1 -1
- package/dist/minuteStart.mjs.map +1 -1
- package/dist/monthDays.d.ts +3 -3
- package/dist/monthDays.mjs.map +1 -1
- package/dist/monthEnd.d.ts +3 -3
- package/dist/monthEnd.mjs.map +1 -1
- package/dist/monthStart.d.ts +3 -3
- package/dist/monthStart.mjs +1 -1
- package/dist/monthStart.mjs.map +1 -1
- package/dist/nearestDay.d.ts +3 -3
- package/dist/nearestDay.mjs +2 -4
- package/dist/nearestDay.mjs.map +1 -1
- package/dist/offset.d.ts +5 -5
- package/dist/offset.mjs +3 -5
- package/dist/offset.mjs.map +1 -1
- package/dist/parse.mjs +33 -23
- package/dist/parse.mjs.map +1 -1
- package/dist/parts.mjs +14 -24
- package/dist/parts.mjs.map +1 -1
- package/dist/range.mjs +1 -2
- package/dist/range.mjs.map +1 -1
- package/dist/removeOffset.d.ts +4 -4
- package/dist/removeOffset.mjs.map +1 -1
- package/dist/sameDay.d.ts +8 -2
- package/dist/sameDay.mjs.map +1 -1
- package/dist/sameHour.d.ts +8 -2
- package/dist/sameHour.mjs.map +1 -1
- package/dist/sameMillisecond.d.ts +16 -0
- package/dist/sameMillisecond.mjs +11 -0
- package/dist/sameMillisecond.mjs.map +1 -0
- package/dist/sameMinute.d.ts +8 -2
- package/dist/sameMinute.mjs.map +1 -1
- package/dist/sameMonth.d.ts +16 -0
- package/dist/sameMonth.mjs +11 -0
- package/dist/sameMonth.mjs.map +1 -0
- package/dist/sameSecond.d.ts +8 -2
- package/dist/sameSecond.mjs.map +1 -1
- package/dist/sameYear.d.ts +8 -2
- package/dist/sameYear.mjs.map +1 -1
- package/dist/types.d.ts +15 -7
- package/dist/tzDate.d.ts +5 -3
- package/dist/tzDate.mjs.map +1 -1
- package/dist/weekEnd.d.ts +4 -4
- package/dist/weekEnd.mjs +1 -1
- package/dist/weekEnd.mjs.map +1 -1
- package/dist/weekStart.d.ts +4 -4
- package/dist/weekStart.mjs +2 -3
- package/dist/weekStart.mjs.map +1 -1
- package/dist/yearDays.d.ts +3 -3
- package/dist/yearDays.mjs.map +1 -1
- package/dist/yearEnd.d.ts +3 -3
- package/dist/yearEnd.mjs +1 -2
- package/dist/yearEnd.mjs.map +1 -1
- package/dist/yearStart.d.ts +3 -3
- package/dist/yearStart.mjs +2 -3
- package/dist/yearStart.mjs.map +1 -1
- package/package.json +32 -23
package/dist/sameYear.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sameYear.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same year.\n * @param inputDateA - First date to compare\n * @param inputDateB - Second date to compare\n */\nexport function sameYear(inputDateA: DateInput, inputDateB: DateInput) {\n const a = date(inputDateA)\n const b = date(inputDateB)\n return a.getFullYear() === b.getFullYear()\n}\n"],"mappings":";AAAA,SAAS,YAAY;
|
|
1
|
+
{"version":3,"sources":["../src/sameYear.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Checks if two date objects refer to the same year.\n * @param inputDateA - First date to compare\n * @param [inputDateB] - Second date to compare or the current time if null given\n */\nexport function sameYear(inputDateA: DateInput, inputDateB?: MaybeDateInput): boolean\n/**\n * Checks if two date objects refer to the same year.\n * @param [inputDateA] - First date to compare or the current time if null given\n * @param inputDateB - Second date to compare\n */\nexport function sameYear(inputDateA: MaybeDateInput, inputDateB: DateInput): boolean\nexport function sameYear(\n inputDateA: MaybeDateInput,\n inputDateB?: MaybeDateInput\n): boolean {\n const a = date(inputDateA)\n const b = date(inputDateB)\n return a.getFullYear() === b.getFullYear()\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAed,SAAS,SACd,YACA,YACS;AACT,QAAM,IAAI,KAAK,UAAU;AACzB,QAAM,IAAI,KAAK,UAAU;AACzB,SAAO,EAAE,YAAY,MAAM,EAAE,YAAY;AAC3C;","names":[]}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
* The date format used as an input value. Either a date or an ISO8601 string.
|
|
3
3
|
*/
|
|
4
4
|
type DateInput = Date | string;
|
|
5
|
+
/**
|
|
6
|
+
* The date format used as a maybe input value. Either a date, ISO8601 string or null for current time
|
|
7
|
+
*/
|
|
8
|
+
type MaybeDateInput = DateInput | null;
|
|
5
9
|
/**
|
|
6
10
|
* Format parts with text names use these descriptors:
|
|
7
11
|
*/
|
|
8
12
|
type NamedFormatOption = "long" | "short" | "narrow";
|
|
13
|
+
/**
|
|
14
|
+
* Extended part types that include custom tokens not in Intl.DateTimeFormatPartTypes.
|
|
15
|
+
*/
|
|
16
|
+
type ExtendedPartTypes = Intl.DateTimeFormatPartTypes | "fractionalSecond";
|
|
9
17
|
/**
|
|
10
18
|
* A registry of named format parts. Each type of part has every option.
|
|
11
19
|
*/
|
|
@@ -28,11 +36,11 @@ interface Part {
|
|
|
28
36
|
option: FormatPattern[1];
|
|
29
37
|
/**
|
|
30
38
|
* The name of the part, these must be valid parts of a date format as
|
|
31
|
-
* specified in Intl.DateTimeFormatPartTypes
|
|
32
|
-
* day, dayPeriod, era, hour, literal, minute, month,
|
|
33
|
-
* weekday, year
|
|
39
|
+
* specified in Intl.DateTimeFormatPartTypes, plus custom extensions.
|
|
40
|
+
* Valid values are: day, dayPeriod, era, hour, literal, minute, month,
|
|
41
|
+
* second, timeZoneName, weekday, year, fractionalSecond
|
|
34
42
|
*/
|
|
35
|
-
partName:
|
|
43
|
+
partName: ExtendedPartTypes;
|
|
36
44
|
/**
|
|
37
45
|
* The value of a given part. For example "2-digit", or "narrow".
|
|
38
46
|
*/
|
|
@@ -61,7 +69,7 @@ type FilledPart = Part & {
|
|
|
61
69
|
*/
|
|
62
70
|
type FormatPattern = [
|
|
63
71
|
pattern: FormatToken | string,
|
|
64
|
-
option: Partial<Record<
|
|
72
|
+
option: Partial<Record<ExtendedPartTypes, string>>,
|
|
65
73
|
exp?: RegExp
|
|
66
74
|
];
|
|
67
75
|
/**
|
|
@@ -83,7 +91,7 @@ type Format = FormatStyle | FormatStyleObj | (string & {});
|
|
|
83
91
|
/**
|
|
84
92
|
* A union of all available formatting tokens.
|
|
85
93
|
*/
|
|
86
|
-
type FormatToken = "YYYY" | "YY" | "MMMM" | "MMM" | "MM" | "M" | "DD" | "D" | "dddd" | "ddd" | "d" | "mm" | "m" | "ss" | "s" | "HH" | "H" | "hh" | "h" | "a" | "A" | "ZZ" | "Z";
|
|
94
|
+
type FormatToken = "YYYY" | "YY" | "MMMM" | "MMM" | "MM" | "M" | "DD" | "D" | "dddd" | "ddd" | "d" | "mm" | "m" | "ss" | "s" | "SSS" | "HH" | "H" | "hh" | "h" | "a" | "A" | "ZZ" | "Z";
|
|
87
95
|
interface ParseOptions {
|
|
88
96
|
/**
|
|
89
97
|
* A string representing a date.
|
|
@@ -140,4 +148,4 @@ interface FormatOptions {
|
|
|
140
148
|
partFilter?: (part: Part) => boolean;
|
|
141
149
|
}
|
|
142
150
|
|
|
143
|
-
export type { DateInput, FilledPart, Format, FormatOptions, FormatPattern, FormatStyle, FormatStyleObj, FormatToken, NamedFormatOption, NamedFormats, ParseOptions, Part };
|
|
151
|
+
export type { DateInput, ExtendedPartTypes, FilledPart, Format, FormatOptions, FormatPattern, FormatStyle, FormatStyleObj, FormatToken, MaybeDateInput, NamedFormatOption, NamedFormats, ParseOptions, Part };
|
package/dist/tzDate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a date object for the input date at the given timezone. For example
|
|
@@ -7,9 +7,11 @@ import { DateInput } from './types.js';
|
|
|
7
7
|
*
|
|
8
8
|
* If given a Date object it will use local time and convert it to the given
|
|
9
9
|
* timezone, thus "changing" the date.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* if given no string or date object, it'll use the current locale time and convert to the given timezone
|
|
12
|
+
* @param [inputDate] - An iso8601 date string with no timezone
|
|
11
13
|
* @param tz - A timezone string
|
|
12
14
|
*/
|
|
13
|
-
declare function tzDate(inputDate:
|
|
15
|
+
declare function tzDate(inputDate: MaybeDateInput, tz: string): Date;
|
|
14
16
|
|
|
15
17
|
export { tzDate };
|
package/dist/tzDate.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tzDate.ts"],"sourcesContent":["import { offset } from \"./offset\"\nimport { applyOffset } from \"./applyOffset\"\nimport { date } from \"./date\"\nimport { DateInput } from \"./types\"\n\n/**\n * Creates a date object for the input date at the given timezone. For example\n * `tzDate(\"2017-05-06T12:00\", \"Europe/Amsterdam\")` will return a date object\n * for 2017-05-06T10:00:00Z since 12:00 in Amsterdam is 10:00Z.\n *\n * If given a Date object it will use local time and convert it to the given\n * timezone, thus \"changing\" the date.\n * @param inputDate - An iso8601 date string with no timezone\n * @param tz - A timezone string\n */\nexport function tzDate(inputDate:
|
|
1
|
+
{"version":3,"sources":["../src/tzDate.ts"],"sourcesContent":["import { offset } from \"./offset\"\nimport { applyOffset } from \"./applyOffset\"\nimport { date } from \"./date\"\nimport { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Creates a date object for the input date at the given timezone. For example\n * `tzDate(\"2017-05-06T12:00\", \"Europe/Amsterdam\")` will return a date object\n * for 2017-05-06T10:00:00Z since 12:00 in Amsterdam is 10:00Z.\n *\n * If given a Date object it will use local time and convert it to the given\n * timezone, thus \"changing\" the date.\n *\n * if given no string or date object, it'll use the current locale time and convert to the given timezone\n * @param [inputDate] - An iso8601 date string with no timezone\n * @param tz - A timezone string\n */\nexport function tzDate(inputDate: MaybeDateInput, tz: string) {\n const d = date(inputDate)\n return applyOffset(d, offset(d, tz))\n}\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AAed,SAAS,OAAO,WAA2B,IAAY;AAC5D,QAAM,IAAI,KAAK,SAAS;AACxB,SAAO,YAAY,GAAG,OAAO,GAAG,EAAE,CAAC;AACrC;","names":[]}
|
package/dist/weekEnd.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for the last day at the last second of the given week.
|
|
5
5
|
* Defaults to Sunday as the first day of the week:
|
|
6
6
|
* 0 = Sunday ... 6 = Saturday
|
|
7
|
-
* @param inputDate - Gets the last day of the week
|
|
8
|
-
* @param startOfWeekDay - The first day of the week
|
|
7
|
+
* @param [inputDate] - Gets the last day of the week
|
|
8
|
+
* @param [startOfWeekDay] - The first day of the week
|
|
9
9
|
*/
|
|
10
|
-
declare function weekEnd(inputDate
|
|
10
|
+
declare function weekEnd(inputDate?: MaybeDateInput, startOfWeekDay?: number): Date;
|
|
11
11
|
|
|
12
12
|
export { weekEnd };
|
package/dist/weekEnd.mjs
CHANGED
package/dist/weekEnd.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/weekEnd.ts"],"sourcesContent":["import { weekStart } from \"./weekStart\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/weekEnd.ts"],"sourcesContent":["import { weekStart } from \"./weekStart\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the last day at the last second of the given week.\n * Defaults to Sunday as the first day of the week:\n * 0 = Sunday ... 6 = Saturday\n * @param [inputDate] - Gets the last day of the week\n * @param [startOfWeekDay] - The first day of the week\n */\nexport function weekEnd(inputDate?: MaybeDateInput, startOfWeekDay = 0): Date {\n const d = weekStart(inputDate, startOfWeekDay)\n d.setDate(d.getDate() + 6)\n d.setHours(23, 59, 59, 999)\n return d\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAUnB,SAAS,QAAQ,WAA4B,iBAAiB,GAAS;AAC5E,QAAM,IAAI,UAAU,WAAW,cAAc;AAC7C,IAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC;AACzB,IAAE,SAAS,IAAI,IAAI,IAAI,GAAG;AAC1B,SAAO;AACT;","names":[]}
|
package/dist/weekStart.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for start of the given week. Defaults to Sunday as the
|
|
5
5
|
* first day of the week:
|
|
6
6
|
* 0 = Sunday ... 6 = Saturday
|
|
7
|
-
* @param inputDate - A string or
|
|
8
|
-
* @param startOfWeekDay - Determines which day of the week is the first
|
|
7
|
+
* @param [inputDate] - A string, Date object or nothing for current week
|
|
8
|
+
* @param [startOfWeekDay] - Determines which day of the week is the first
|
|
9
9
|
*/
|
|
10
|
-
declare function weekStart(inputDate
|
|
10
|
+
declare function weekStart(inputDate?: MaybeDateInput, startOfWeekDay?: number): Date;
|
|
11
11
|
|
|
12
12
|
export { weekStart };
|
package/dist/weekStart.mjs
CHANGED
|
@@ -3,10 +3,9 @@ import { date } from "./date.mjs";
|
|
|
3
3
|
function weekStart(inputDate, startOfWeekDay = 0) {
|
|
4
4
|
const d = date(inputDate);
|
|
5
5
|
let diff = startOfWeekDay - d.getDay();
|
|
6
|
-
if (diff > 0)
|
|
7
|
-
diff = diff - 7;
|
|
6
|
+
if (diff > 0) diff = diff - 7;
|
|
8
7
|
d.setDate(d.getDate() + diff);
|
|
9
|
-
d.setHours(0, 0, 0);
|
|
8
|
+
d.setHours(0, 0, 0, 0);
|
|
10
9
|
return d;
|
|
11
10
|
}
|
|
12
11
|
export {
|
package/dist/weekStart.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/weekStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/weekStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given week. Defaults to Sunday as the\n * first day of the week:\n * 0 = Sunday ... 6 = Saturday\n * @param [inputDate] - A string, Date object or nothing for current week\n * @param [startOfWeekDay] - Determines which day of the week is the first\n */\nexport function weekStart(inputDate?: MaybeDateInput, startOfWeekDay = 0): Date {\n const d = date(inputDate)\n let diff = startOfWeekDay - d.getDay()\n if (diff > 0) diff = diff - 7\n d.setDate(d.getDate() + diff)\n d.setHours(0, 0, 0, 0)\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAUd,SAAS,UAAU,WAA4B,iBAAiB,GAAS;AAC9E,QAAM,IAAI,KAAK,SAAS;AACxB,MAAI,OAAO,iBAAiB,EAAE,OAAO;AACrC,MAAI,OAAO,EAAG,QAAO,OAAO;AAC5B,IAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI;AAC5B,IAAE,SAAS,GAAG,GAAG,GAAG,CAAC;AACrB,SAAO;AACT;","names":[]}
|
package/dist/yearDays.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the number of days in the given date’s year.
|
|
5
|
-
* @param inputDate -
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current year
|
|
6
6
|
*/
|
|
7
|
-
declare function yearDays(inputDate
|
|
7
|
+
declare function yearDays(inputDate?: MaybeDateInput): number;
|
|
8
8
|
|
|
9
9
|
export { yearDays };
|
package/dist/yearDays.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/yearDays.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/yearDays.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Get the number of days in the given date’s year.\n * @param [inputDate] - A string, Date object or nothing for the current year\n */\nexport function yearDays(inputDate?: MaybeDateInput): number {\n const d = date(inputDate)\n return (\n (new Date(d.getFullYear() + 1, 0, 0).getTime() -\n new Date(d.getFullYear(), 0, 0).getTime()) /\n 86400000\n )\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAOd,SAAS,SAAS,WAAoC;AAC3D,QAAM,IAAI,KAAK,SAAS;AACxB,UACG,IAAI,KAAK,EAAE,YAAY,IAAI,GAAG,GAAG,CAAC,EAAE,QAAQ,IAC3C,IAAI,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,EAAE,QAAQ,KAC1C;AAEJ;","names":[]}
|
package/dist/yearEnd.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for the with the input date set to the end of the current year.
|
|
5
|
-
* @param inputDate - A string or
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current year
|
|
6
6
|
*/
|
|
7
|
-
declare function yearEnd(inputDate
|
|
7
|
+
declare function yearEnd(inputDate?: MaybeDateInput): Date;
|
|
8
8
|
|
|
9
9
|
export { yearEnd };
|
package/dist/yearEnd.mjs
CHANGED
package/dist/yearEnd.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/yearEnd.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/yearEnd.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the with the input date set to the end of the current year.\n * @param [inputDate] - A string, Date object or nothing for the current year\n */\nexport function yearEnd(inputDate?: MaybeDateInput): Date {\n const d = date(inputDate)\n\n d.setMonth(11, 31)\n d.setHours(23, 59, 59, 999)\n\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAOd,SAAS,QAAQ,WAAkC;AACxD,QAAM,IAAI,KAAK,SAAS;AAExB,IAAE,SAAS,IAAI,EAAE;AACjB,IAAE,SAAS,IAAI,IAAI,IAAI,GAAG;AAE1B,SAAO;AACT;","names":[]}
|
package/dist/yearStart.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for the with the input date set to the start of the current year.
|
|
5
|
-
* @param inputDate - A string or
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current year
|
|
6
6
|
*/
|
|
7
|
-
declare function yearStart(inputDate
|
|
7
|
+
declare function yearStart(inputDate?: MaybeDateInput): Date;
|
|
8
8
|
|
|
9
9
|
export { yearStart };
|
package/dist/yearStart.mjs
CHANGED
package/dist/yearStart.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/yearStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/yearStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the with the input date set to the start of the current year.\n * @param [inputDate] - A string, Date object or nothing for the current year\n */\nexport function yearStart(inputDate?: MaybeDateInput): Date {\n const d = date(inputDate)\n\n d.setMonth(0, 1)\n d.setHours(0, 0, 0, 0)\n\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAOd,SAAS,UAAU,WAAkC;AAC1D,QAAM,IAAI,KAAK,SAAS;AAExB,IAAE,SAAS,GAAG,CAAC;AACf,IAAE,SAAS,GAAG,GAAG,GAAG,CAAC;AAErB,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formkit/tempo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"packageManager": "pnpm@10.11.0",
|
|
4
5
|
"description": "The easiest way to work with dates in JavaScript and TypeScript.",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.cjs",
|
|
@@ -23,6 +24,24 @@
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
},
|
|
27
|
+
"homepage": "https://github.com/formkit/tempo",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/formkit/tempo.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/formkit/tempo/issues"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "cd ./docs && pnpm nuxt dev",
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"post:build": "node scripts/size-limit/index.js || echo 'Size limit check skipped'",
|
|
39
|
+
"test": "TZ=\"America/New_York\" vitest",
|
|
40
|
+
"docs-build": "cd ./docs && pnpm run build",
|
|
41
|
+
"publint": "publint",
|
|
42
|
+
"release": "pnpm build && bumpp --push",
|
|
43
|
+
"size": "npm run build && size-limit"
|
|
44
|
+
},
|
|
26
45
|
"files": [
|
|
27
46
|
"dist",
|
|
28
47
|
"docs/public/read-the-docs.png",
|
|
@@ -37,27 +56,17 @@
|
|
|
37
56
|
"author": "Justin Schroeder <justin@formkit.com>",
|
|
38
57
|
"license": "MIT",
|
|
39
58
|
"devDependencies": {
|
|
40
|
-
"@size-limit/esbuild": "^
|
|
41
|
-
"@size-limit/file": "^
|
|
42
|
-
"@size-limit/preset-small-lib": "^
|
|
43
|
-
"@types/node": "^
|
|
44
|
-
"bumpp": "^
|
|
59
|
+
"@size-limit/esbuild": "^12.0.0",
|
|
60
|
+
"@size-limit/file": "^12.0.0",
|
|
61
|
+
"@size-limit/preset-small-lib": "^12.0.0",
|
|
62
|
+
"@types/node": "^25.0.3",
|
|
63
|
+
"bumpp": "^10.3.2",
|
|
45
64
|
"bytes-iec": "^3.1.1",
|
|
46
|
-
"esbuild-plugin-file-path-extensions": "^2.
|
|
47
|
-
"publint": "^0.
|
|
48
|
-
"size-limit": "^
|
|
49
|
-
"tsup": "^8.
|
|
50
|
-
"typescript": "^5.
|
|
51
|
-
"vitest": "^
|
|
52
|
-
},
|
|
53
|
-
"scripts": {
|
|
54
|
-
"dev": "cd ./docs && pnpm nuxt dev",
|
|
55
|
-
"build": "tsup",
|
|
56
|
-
"post:build": "node scripts/size-limit/index.js",
|
|
57
|
-
"test": "TZ=\"America/New_York\" vitest",
|
|
58
|
-
"docs-build": "cd ./docs && pnpm run build",
|
|
59
|
-
"publint": "publint",
|
|
60
|
-
"release": "pnpm build && bumpp && pnpm publish",
|
|
61
|
-
"size": "npm run build && size-limit"
|
|
65
|
+
"esbuild-plugin-file-path-extensions": "^2.1.4",
|
|
66
|
+
"publint": "^0.3.16",
|
|
67
|
+
"size-limit": "^12.0.0",
|
|
68
|
+
"tsup": "^8.5.1",
|
|
69
|
+
"typescript": "^5.9.3",
|
|
70
|
+
"vitest": "^4.0.16"
|
|
62
71
|
}
|
|
63
|
-
}
|
|
72
|
+
}
|