@bemoje/date 1.1.1 → 1.1.3

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 (60) hide show
  1. package/README.md +22 -21
  2. package/lib/index.d.cts +90 -14
  3. package/lib/index.d.ts +90 -14
  4. package/package.json +22 -208
  5. package/lib/Timer.cjs +0 -21
  6. package/lib/Timer.d.cts +0 -6
  7. package/lib/Timer.d.ts +0 -6
  8. package/lib/Timer.js +0 -19
  9. package/lib/dateString.cjs +0 -12
  10. package/lib/dateString.d.cts +0 -6
  11. package/lib/dateString.d.ts +0 -6
  12. package/lib/dateString.js +0 -10
  13. package/lib/daysToMs.cjs +0 -12
  14. package/lib/daysToMs.d.cts +0 -6
  15. package/lib/daysToMs.d.ts +0 -6
  16. package/lib/daysToMs.js +0 -10
  17. package/lib/getWeek.cjs +0 -15
  18. package/lib/getWeek.d.cts +0 -6
  19. package/lib/getWeek.d.ts +0 -6
  20. package/lib/getWeek.js +0 -13
  21. package/lib/hasCooldownElapsed.cjs +0 -13
  22. package/lib/hasCooldownElapsed.d.cts +0 -10
  23. package/lib/hasCooldownElapsed.d.ts +0 -10
  24. package/lib/hasCooldownElapsed.js +0 -11
  25. package/lib/hoursToMs.cjs +0 -12
  26. package/lib/hoursToMs.d.cts +0 -6
  27. package/lib/hoursToMs.d.ts +0 -6
  28. package/lib/hoursToMs.js +0 -10
  29. package/lib/minutesToMs.cjs +0 -12
  30. package/lib/minutesToMs.d.cts +0 -6
  31. package/lib/minutesToMs.d.ts +0 -6
  32. package/lib/minutesToMs.js +0 -10
  33. package/lib/monthNameDa.cjs +0 -30
  34. package/lib/monthNameDa.d.cts +0 -14
  35. package/lib/monthNameDa.d.ts +0 -14
  36. package/lib/monthNameDa.js +0 -28
  37. package/lib/monthNameDaRelative.cjs +0 -38
  38. package/lib/monthNameDaRelative.d.cts +0 -13
  39. package/lib/monthNameDaRelative.d.ts +0 -13
  40. package/lib/monthNameDaRelative.js +0 -36
  41. package/lib/msSinceDate.cjs +0 -12
  42. package/lib/msSinceDate.d.cts +0 -6
  43. package/lib/msSinceDate.d.ts +0 -6
  44. package/lib/msSinceDate.js +0 -10
  45. package/lib/secondsToMs.cjs +0 -12
  46. package/lib/secondsToMs.d.cts +0 -6
  47. package/lib/secondsToMs.d.ts +0 -6
  48. package/lib/secondsToMs.js +0 -10
  49. package/lib/stripTime.cjs +0 -12
  50. package/lib/stripTime.d.cts +0 -6
  51. package/lib/stripTime.d.ts +0 -6
  52. package/lib/stripTime.js +0 -10
  53. package/lib/today.cjs +0 -18
  54. package/lib/today.d.cts +0 -6
  55. package/lib/today.d.ts +0 -6
  56. package/lib/today.js +0 -16
  57. package/lib/yesterday.cjs +0 -26
  58. package/lib/yesterday.d.cts +0 -6
  59. package/lib/yesterday.d.ts +0 -6
  60. package/lib/yesterday.js +0 -24
package/lib/getWeek.d.cts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the week number of the year for a given date using Danish locale.
3
- */
4
- declare function getWeek(date: Date): number;
5
-
6
- export { getWeek };
package/lib/getWeek.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the week number of the year for a given date using Danish locale.
3
- */
4
- declare function getWeek(date: Date): number;
5
-
6
- export { getWeek };
package/lib/getWeek.js DELETED
@@ -1,13 +0,0 @@
1
- import { da } from 'date-fns/locale';
2
- import { getWeek as getWeek$1 } from 'date-fns';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- function getWeek(date) {
7
- return getWeek$1(date, {
8
- locale: da
9
- });
10
- }
11
- __name(getWeek, "getWeek");
12
-
13
- export { getWeek };
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/hasCooldownElapsed.ts
7
- function hasCooldownElapsed(startDate, cooldownMs) {
8
- const elapsedMs = Date.now() - startDate.getTime();
9
- return elapsedMs > cooldownMs;
10
- }
11
- __name(hasCooldownElapsed, "hasCooldownElapsed");
12
-
13
- exports.hasCooldownElapsed = hasCooldownElapsed;
@@ -1,10 +0,0 @@
1
- /**
2
- * Determines if a specified cooldown period has elapsed since a given date.
3
- *
4
- * @param startDate - The starting date to calculate elapsed time from.
5
- * @param cooldownMs - The cooldown duration in milliseconds.
6
- * @returns `true` if the cooldown period has elapsed, otherwise `false`.
7
- */
8
- declare function hasCooldownElapsed(startDate: Date, cooldownMs: number): boolean;
9
-
10
- export { hasCooldownElapsed };
@@ -1,10 +0,0 @@
1
- /**
2
- * Determines if a specified cooldown period has elapsed since a given date.
3
- *
4
- * @param startDate - The starting date to calculate elapsed time from.
5
- * @param cooldownMs - The cooldown duration in milliseconds.
6
- * @returns `true` if the cooldown period has elapsed, otherwise `false`.
7
- */
8
- declare function hasCooldownElapsed(startDate: Date, cooldownMs: number): boolean;
9
-
10
- export { hasCooldownElapsed };
@@ -1,11 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/hasCooldownElapsed.ts
5
- function hasCooldownElapsed(startDate, cooldownMs) {
6
- const elapsedMs = Date.now() - startDate.getTime();
7
- return elapsedMs > cooldownMs;
8
- }
9
- __name(hasCooldownElapsed, "hasCooldownElapsed");
10
-
11
- export { hasCooldownElapsed };
package/lib/hoursToMs.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/hoursToMs.ts
7
- function hoursToMs(hours) {
8
- return 1e3 * 60 * 60 * hours;
9
- }
10
- __name(hoursToMs, "hoursToMs");
11
-
12
- exports.hoursToMs = hoursToMs;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts hours to milliseconds.
3
- */
4
- declare function hoursToMs(hours: number): number;
5
-
6
- export { hoursToMs };
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts hours to milliseconds.
3
- */
4
- declare function hoursToMs(hours: number): number;
5
-
6
- export { hoursToMs };
package/lib/hoursToMs.js DELETED
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/hoursToMs.ts
5
- function hoursToMs(hours) {
6
- return 1e3 * 60 * 60 * hours;
7
- }
8
- __name(hoursToMs, "hoursToMs");
9
-
10
- export { hoursToMs };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/minutesToMs.ts
7
- function minutesToMs(minutes) {
8
- return 1e3 * 60 * minutes;
9
- }
10
- __name(minutesToMs, "minutesToMs");
11
-
12
- exports.minutesToMs = minutesToMs;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts minutes to milliseconds.
3
- */
4
- declare function minutesToMs(minutes: number): number;
5
-
6
- export { minutesToMs };
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts minutes to milliseconds.
3
- */
4
- declare function minutesToMs(minutes: number): number;
5
-
6
- export { minutesToMs };
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/minutesToMs.ts
5
- function minutesToMs(minutes) {
6
- return 1e3 * 60 * minutes;
7
- }
8
- __name(minutesToMs, "minutesToMs");
9
-
10
- export { minutesToMs };
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/monthNameDa.ts
7
- function monthNameDa(month) {
8
- if (month < 1 || month > 12) {
9
- throw new Error(`Invalid month number. Got: ${month}`);
10
- }
11
- return MONTH_NAMES_DA[month];
12
- }
13
- __name(monthNameDa, "monthNameDa");
14
- var MONTH_NAMES_DA = [
15
- "",
16
- "Januar",
17
- "Februar",
18
- "Marts",
19
- "April",
20
- "Maj",
21
- "Juni",
22
- "Juli",
23
- "August",
24
- "September",
25
- "Oktober",
26
- "November",
27
- "December"
28
- ];
29
-
30
- exports.monthNameDa = monthNameDa;
@@ -1,14 +0,0 @@
1
- /**
2
- * Returns the name, in Danish language, of the month corresponding to the provided month number.
3
- *
4
- * @param month - A month number between 1 and 12.
5
- *
6
- * @throws if the provided month number is not a valid month.
7
- *
8
- * @example ```ts
9
- * monthNameDA(9) //=> 'September'
10
- * ```
11
- */
12
- declare function monthNameDa(month: number): string;
13
-
14
- export { monthNameDa };
@@ -1,14 +0,0 @@
1
- /**
2
- * Returns the name, in Danish language, of the month corresponding to the provided month number.
3
- *
4
- * @param month - A month number between 1 and 12.
5
- *
6
- * @throws if the provided month number is not a valid month.
7
- *
8
- * @example ```ts
9
- * monthNameDA(9) //=> 'September'
10
- * ```
11
- */
12
- declare function monthNameDa(month: number): string;
13
-
14
- export { monthNameDa };
@@ -1,28 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/monthNameDa.ts
5
- function monthNameDa(month) {
6
- if (month < 1 || month > 12) {
7
- throw new Error(`Invalid month number. Got: ${month}`);
8
- }
9
- return MONTH_NAMES_DA[month];
10
- }
11
- __name(monthNameDa, "monthNameDa");
12
- var MONTH_NAMES_DA = [
13
- "",
14
- "Januar",
15
- "Februar",
16
- "Marts",
17
- "April",
18
- "Maj",
19
- "Juni",
20
- "Juli",
21
- "August",
22
- "September",
23
- "Oktober",
24
- "November",
25
- "December"
26
- ];
27
-
28
- export { monthNameDa };
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- var dateFns = require('date-fns');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
-
8
- // src/monthNameDa.ts
9
- function monthNameDa(month) {
10
- if (month < 1 || month > 12) {
11
- throw new Error(`Invalid month number. Got: ${month}`);
12
- }
13
- return MONTH_NAMES_DA[month];
14
- }
15
- __name(monthNameDa, "monthNameDa");
16
- var MONTH_NAMES_DA = [
17
- "",
18
- "Januar",
19
- "Februar",
20
- "Marts",
21
- "April",
22
- "Maj",
23
- "Juni",
24
- "Juli",
25
- "August",
26
- "September",
27
- "Oktober",
28
- "November",
29
- "December"
30
- ];
31
-
32
- // src/monthNameDaRelative.ts
33
- function monthNameDaRelative(n) {
34
- return monthNameDa(dateFns.addMonths(/* @__PURE__ */ new Date(), n).getUTCMonth() + 1);
35
- }
36
- __name(monthNameDaRelative, "monthNameDaRelative");
37
-
38
- exports.monthNameDaRelative = monthNameDaRelative;
@@ -1,13 +0,0 @@
1
- /**
2
- * Get the (Danish) name of the month relative to the current month.
3
- *
4
- * @example ```ts
5
- * // assuming current month is August
6
- * monthNameDaRelative(-1) //=> 'Juli'
7
- * monthNameDaRelative(0) //=> 'August'
8
- * monthNameDaRelative(1) //=> 'September'
9
- * ```
10
- */
11
- declare function monthNameDaRelative(n: number): string;
12
-
13
- export { monthNameDaRelative };
@@ -1,13 +0,0 @@
1
- /**
2
- * Get the (Danish) name of the month relative to the current month.
3
- *
4
- * @example ```ts
5
- * // assuming current month is August
6
- * monthNameDaRelative(-1) //=> 'Juli'
7
- * monthNameDaRelative(0) //=> 'August'
8
- * monthNameDaRelative(1) //=> 'September'
9
- * ```
10
- */
11
- declare function monthNameDaRelative(n: number): string;
12
-
13
- export { monthNameDaRelative };
@@ -1,36 +0,0 @@
1
- import { addMonths } from 'date-fns';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/monthNameDa.ts
7
- function monthNameDa(month) {
8
- if (month < 1 || month > 12) {
9
- throw new Error(`Invalid month number. Got: ${month}`);
10
- }
11
- return MONTH_NAMES_DA[month];
12
- }
13
- __name(monthNameDa, "monthNameDa");
14
- var MONTH_NAMES_DA = [
15
- "",
16
- "Januar",
17
- "Februar",
18
- "Marts",
19
- "April",
20
- "Maj",
21
- "Juni",
22
- "Juli",
23
- "August",
24
- "September",
25
- "Oktober",
26
- "November",
27
- "December"
28
- ];
29
-
30
- // src/monthNameDaRelative.ts
31
- function monthNameDaRelative(n) {
32
- return monthNameDa(addMonths(/* @__PURE__ */ new Date(), n).getUTCMonth() + 1);
33
- }
34
- __name(monthNameDaRelative, "monthNameDaRelative");
35
-
36
- export { monthNameDaRelative };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/msSinceDate.ts
7
- function msSinceDate(date) {
8
- return Date.now() - new Date(date).getTime();
9
- }
10
- __name(msSinceDate, "msSinceDate");
11
-
12
- exports.msSinceDate = msSinceDate;
@@ -1,6 +0,0 @@
1
- /**
2
- * Calculates the number of milliseconds that have elapsed since the given date.
3
- */
4
- declare function msSinceDate(date: Date | string | number): number;
5
-
6
- export { msSinceDate };
@@ -1,6 +0,0 @@
1
- /**
2
- * Calculates the number of milliseconds that have elapsed since the given date.
3
- */
4
- declare function msSinceDate(date: Date | string | number): number;
5
-
6
- export { msSinceDate };
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/msSinceDate.ts
5
- function msSinceDate(date) {
6
- return Date.now() - new Date(date).getTime();
7
- }
8
- __name(msSinceDate, "msSinceDate");
9
-
10
- export { msSinceDate };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/secondsToMs.ts
7
- function secondsToMs(seconds) {
8
- return 1e3 * seconds;
9
- }
10
- __name(secondsToMs, "secondsToMs");
11
-
12
- exports.secondsToMs = secondsToMs;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts seconds to milliseconds.
3
- */
4
- declare function secondsToMs(seconds: number): number;
5
-
6
- export { secondsToMs };
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts seconds to milliseconds.
3
- */
4
- declare function secondsToMs(seconds: number): number;
5
-
6
- export { secondsToMs };
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/secondsToMs.ts
5
- function secondsToMs(seconds) {
6
- return 1e3 * seconds;
7
- }
8
- __name(secondsToMs, "secondsToMs");
9
-
10
- export { secondsToMs };
package/lib/stripTime.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/stripTime.ts
7
- function stripTime(date) {
8
- return new Date(date.toISOString().slice(0, 10));
9
- }
10
- __name(stripTime, "stripTime");
11
-
12
- exports.stripTime = stripTime;
@@ -1,6 +0,0 @@
1
- /**
2
- * Remove the time component from a date, returning only the date part.
3
- */
4
- declare function stripTime(date: Date): Date;
5
-
6
- export { stripTime };
@@ -1,6 +0,0 @@
1
- /**
2
- * Remove the time component from a date, returning only the date part.
3
- */
4
- declare function stripTime(date: Date): Date;
5
-
6
- export { stripTime };
package/lib/stripTime.js DELETED
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/stripTime.ts
5
- function stripTime(date) {
6
- return new Date(date.toISOString().slice(0, 10));
7
- }
8
- __name(stripTime, "stripTime");
9
-
10
- export { stripTime };
package/lib/today.cjs DELETED
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/stripTime.ts
7
- function stripTime(date) {
8
- return new Date(date.toISOString().slice(0, 10));
9
- }
10
- __name(stripTime, "stripTime");
11
-
12
- // src/today.ts
13
- function today() {
14
- return stripTime(new Date(Date.now()));
15
- }
16
- __name(today, "today");
17
-
18
- exports.today = today;
package/lib/today.d.cts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the UTC date today, time stripped
3
- */
4
- declare function today(): Date;
5
-
6
- export { today };
package/lib/today.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the UTC date today, time stripped
3
- */
4
- declare function today(): Date;
5
-
6
- export { today };
package/lib/today.js DELETED
@@ -1,16 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/stripTime.ts
5
- function stripTime(date) {
6
- return new Date(date.toISOString().slice(0, 10));
7
- }
8
- __name(stripTime, "stripTime");
9
-
10
- // src/today.ts
11
- function today() {
12
- return stripTime(new Date(Date.now()));
13
- }
14
- __name(today, "today");
15
-
16
- export { today };
package/lib/yesterday.cjs DELETED
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- var dateFns = require('date-fns');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
-
8
- // src/stripTime.ts
9
- function stripTime(date) {
10
- return new Date(date.toISOString().slice(0, 10));
11
- }
12
- __name(stripTime, "stripTime");
13
-
14
- // src/today.ts
15
- function today() {
16
- return stripTime(new Date(Date.now()));
17
- }
18
- __name(today, "today");
19
-
20
- // src/yesterday.ts
21
- function yesterday() {
22
- return stripTime(dateFns.subDays(today(), 1));
23
- }
24
- __name(yesterday, "yesterday");
25
-
26
- exports.yesterday = yesterday;
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the UTC date yesterday, time stripped
3
- */
4
- declare function yesterday(): Date;
5
-
6
- export { yesterday };
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the UTC date yesterday, time stripped
3
- */
4
- declare function yesterday(): Date;
5
-
6
- export { yesterday };
package/lib/yesterday.js DELETED
@@ -1,24 +0,0 @@
1
- import { subDays } from 'date-fns';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // src/stripTime.ts
7
- function stripTime(date) {
8
- return new Date(date.toISOString().slice(0, 10));
9
- }
10
- __name(stripTime, "stripTime");
11
-
12
- // src/today.ts
13
- function today() {
14
- return stripTime(new Date(Date.now()));
15
- }
16
- __name(today, "today");
17
-
18
- // src/yesterday.ts
19
- function yesterday() {
20
- return stripTime(subDays(today(), 1));
21
- }
22
- __name(yesterday, "yesterday");
23
-
24
- export { yesterday };