@bemoje/date 1.1.0 → 1.1.2
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/lib/index.cjs +122 -98
- package/lib/index.d.cts +90 -14
- package/lib/index.d.ts +90 -14
- package/lib/index.js +112 -14
- package/package.json +78 -134
- package/lib/Timer.cjs +0 -21
- package/lib/Timer.d.cts +0 -6
- package/lib/Timer.d.ts +0 -6
- package/lib/Timer.js +0 -18
- package/lib/dateString.cjs +0 -12
- package/lib/dateString.d.cts +0 -6
- package/lib/dateString.d.ts +0 -6
- package/lib/dateString.js +0 -9
- package/lib/daysToMs.cjs +0 -10
- package/lib/daysToMs.d.cts +0 -6
- package/lib/daysToMs.d.ts +0 -6
- package/lib/daysToMs.js +0 -8
- package/lib/getWeek.cjs +0 -15
- package/lib/getWeek.d.cts +0 -6
- package/lib/getWeek.d.ts +0 -6
- package/lib/getWeek.js +0 -12
- package/lib/hasCooldownElapsed.cjs +0 -11
- package/lib/hasCooldownElapsed.d.cts +0 -10
- package/lib/hasCooldownElapsed.d.ts +0 -10
- package/lib/hasCooldownElapsed.js +0 -9
- package/lib/hoursToMs.cjs +0 -10
- package/lib/hoursToMs.d.cts +0 -6
- package/lib/hoursToMs.d.ts +0 -6
- package/lib/hoursToMs.js +0 -8
- package/lib/minutesToMs.cjs +0 -10
- package/lib/minutesToMs.d.cts +0 -6
- package/lib/minutesToMs.d.ts +0 -6
- package/lib/minutesToMs.js +0 -8
- package/lib/monthNameDa.cjs +0 -28
- package/lib/monthNameDa.d.cts +0 -14
- package/lib/monthNameDa.d.ts +0 -14
- package/lib/monthNameDa.js +0 -26
- package/lib/monthNameDaRelative.cjs +0 -13
- package/lib/monthNameDaRelative.d.cts +0 -13
- package/lib/monthNameDaRelative.d.ts +0 -13
- package/lib/monthNameDaRelative.js +0 -10
- package/lib/msSinceDate.cjs +0 -10
- package/lib/msSinceDate.d.cts +0 -6
- package/lib/msSinceDate.d.ts +0 -6
- package/lib/msSinceDate.js +0 -8
- package/lib/secondsToMs.cjs +0 -10
- package/lib/secondsToMs.d.cts +0 -6
- package/lib/secondsToMs.d.ts +0 -6
- package/lib/secondsToMs.js +0 -8
- package/lib/stripTime.cjs +0 -10
- package/lib/stripTime.d.cts +0 -6
- package/lib/stripTime.d.ts +0 -6
- package/lib/stripTime.js +0 -8
- package/lib/today.cjs +0 -12
- package/lib/today.d.cts +0 -6
- package/lib/today.d.ts +0 -6
- package/lib/today.js +0 -9
- package/lib/yesterday.cjs +0 -14
- package/lib/yesterday.d.cts +0 -6
- package/lib/yesterday.d.ts +0 -6
- package/lib/yesterday.js +0 -11
package/lib/index.cjs
CHANGED
|
@@ -1,103 +1,127 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var getWeek = require('./getWeek');
|
|
7
|
-
var hasCooldownElapsed = require('./hasCooldownElapsed');
|
|
8
|
-
var hoursToMs = require('./hoursToMs');
|
|
9
|
-
var minutesToMs = require('./minutesToMs');
|
|
10
|
-
var monthNameDa = require('./monthNameDa');
|
|
11
|
-
var monthNameDaRelative = require('./monthNameDaRelative');
|
|
12
|
-
var msSinceDate = require('./msSinceDate');
|
|
13
|
-
var secondsToMs = require('./secondsToMs');
|
|
14
|
-
var stripTime = require('./stripTime');
|
|
15
|
-
var today = require('./today');
|
|
16
|
-
var yesterday = require('./yesterday');
|
|
3
|
+
var enhancedMs = require('enhanced-ms');
|
|
4
|
+
var dateFns = require('date-fns');
|
|
5
|
+
var locale = require('date-fns/locale');
|
|
17
6
|
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
function Timer(startTime = Date.now()) {
|
|
10
|
+
return function(endTime = Date.now()) {
|
|
11
|
+
const duration = endTime - startTime;
|
|
12
|
+
if (duration === 0) {
|
|
13
|
+
return "0ms";
|
|
14
|
+
}
|
|
15
|
+
const string = enhancedMs.ms(duration, {
|
|
16
|
+
useAbbreviations: true
|
|
17
|
+
});
|
|
18
|
+
return string ?? `${duration}ms`;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
__name(Timer, "Timer");
|
|
22
|
+
function dateString(date) {
|
|
23
|
+
return dateFns.format(date ? new Date(date) : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
24
|
+
}
|
|
25
|
+
__name(dateString, "dateString");
|
|
18
26
|
|
|
27
|
+
// src/daysToMs.ts
|
|
28
|
+
function daysToMs(days) {
|
|
29
|
+
return 1e3 * 60 * 60 * 24 * days;
|
|
30
|
+
}
|
|
31
|
+
__name(daysToMs, "daysToMs");
|
|
32
|
+
function getWeek(date) {
|
|
33
|
+
return dateFns.getWeek(date, {
|
|
34
|
+
locale: locale.da
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
__name(getWeek, "getWeek");
|
|
19
38
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
39
|
+
// src/hasCooldownElapsed.ts
|
|
40
|
+
function hasCooldownElapsed(startDate, cooldownMs) {
|
|
41
|
+
const elapsedMs = Date.now() - startDate.getTime();
|
|
42
|
+
return elapsedMs > cooldownMs;
|
|
43
|
+
}
|
|
44
|
+
__name(hasCooldownElapsed, "hasCooldownElapsed");
|
|
45
|
+
|
|
46
|
+
// src/hoursToMs.ts
|
|
47
|
+
function hoursToMs(hours) {
|
|
48
|
+
return 1e3 * 60 * 60 * hours;
|
|
49
|
+
}
|
|
50
|
+
__name(hoursToMs, "hoursToMs");
|
|
51
|
+
|
|
52
|
+
// src/minutesToMs.ts
|
|
53
|
+
function minutesToMs(minutes) {
|
|
54
|
+
return 1e3 * 60 * minutes;
|
|
55
|
+
}
|
|
56
|
+
__name(minutesToMs, "minutesToMs");
|
|
57
|
+
|
|
58
|
+
// src/monthNameDa.ts
|
|
59
|
+
function monthNameDa(month) {
|
|
60
|
+
if (month < 1 || month > 12) {
|
|
61
|
+
throw new Error(`Invalid month number. Got: ${month}`);
|
|
62
|
+
}
|
|
63
|
+
return MONTH_NAMES_DA[month];
|
|
64
|
+
}
|
|
65
|
+
__name(monthNameDa, "monthNameDa");
|
|
66
|
+
var MONTH_NAMES_DA = [
|
|
67
|
+
"",
|
|
68
|
+
"Januar",
|
|
69
|
+
"Februar",
|
|
70
|
+
"Marts",
|
|
71
|
+
"April",
|
|
72
|
+
"Maj",
|
|
73
|
+
"Juni",
|
|
74
|
+
"Juli",
|
|
75
|
+
"August",
|
|
76
|
+
"September",
|
|
77
|
+
"Oktober",
|
|
78
|
+
"November",
|
|
79
|
+
"December"
|
|
80
|
+
];
|
|
81
|
+
function monthNameDaRelative(n) {
|
|
82
|
+
return monthNameDa(dateFns.addMonths(/* @__PURE__ */ new Date(), n).getUTCMonth() + 1);
|
|
83
|
+
}
|
|
84
|
+
__name(monthNameDaRelative, "monthNameDaRelative");
|
|
85
|
+
|
|
86
|
+
// src/msSinceDate.ts
|
|
87
|
+
function msSinceDate(date) {
|
|
88
|
+
return Date.now() - new Date(date).getTime();
|
|
89
|
+
}
|
|
90
|
+
__name(msSinceDate, "msSinceDate");
|
|
91
|
+
|
|
92
|
+
// src/secondsToMs.ts
|
|
93
|
+
function secondsToMs(seconds) {
|
|
94
|
+
return 1e3 * seconds;
|
|
95
|
+
}
|
|
96
|
+
__name(secondsToMs, "secondsToMs");
|
|
97
|
+
|
|
98
|
+
// src/stripTime.ts
|
|
99
|
+
function stripTime(date) {
|
|
100
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
101
|
+
}
|
|
102
|
+
__name(stripTime, "stripTime");
|
|
103
|
+
|
|
104
|
+
// src/today.ts
|
|
105
|
+
function today() {
|
|
106
|
+
return stripTime(new Date(Date.now()));
|
|
107
|
+
}
|
|
108
|
+
__name(today, "today");
|
|
109
|
+
function yesterday() {
|
|
110
|
+
return stripTime(dateFns.subDays(today(), 1));
|
|
111
|
+
}
|
|
112
|
+
__name(yesterday, "yesterday");
|
|
113
|
+
|
|
114
|
+
exports.Timer = Timer;
|
|
115
|
+
exports.dateString = dateString;
|
|
116
|
+
exports.daysToMs = daysToMs;
|
|
117
|
+
exports.getWeek = getWeek;
|
|
118
|
+
exports.hasCooldownElapsed = hasCooldownElapsed;
|
|
119
|
+
exports.hoursToMs = hoursToMs;
|
|
120
|
+
exports.minutesToMs = minutesToMs;
|
|
121
|
+
exports.monthNameDa = monthNameDa;
|
|
122
|
+
exports.monthNameDaRelative = monthNameDaRelative;
|
|
123
|
+
exports.msSinceDate = msSinceDate;
|
|
124
|
+
exports.secondsToMs = secondsToMs;
|
|
125
|
+
exports.stripTime = stripTime;
|
|
126
|
+
exports.today = today;
|
|
127
|
+
exports.yesterday = yesterday;
|
package/lib/index.d.cts
CHANGED
|
@@ -1,14 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that returns the elapsed time since invokation.
|
|
3
|
+
*/
|
|
4
|
+
declare function Timer(startTime?: number): (endTime?: number) => string;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reutnrs the date formatted as: yyyy-MM-dd
|
|
8
|
+
*/
|
|
9
|
+
declare function dateString(date?: Date | number | string): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Converts days to milliseconds.
|
|
13
|
+
*/
|
|
14
|
+
declare function daysToMs(days: number): number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the week number of the year for a given date using Danish locale.
|
|
18
|
+
*/
|
|
19
|
+
declare function getWeek(date: Date): number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Determines if a specified cooldown period has elapsed since a given date.
|
|
23
|
+
*
|
|
24
|
+
* @param startDate - The starting date to calculate elapsed time from.
|
|
25
|
+
* @param cooldownMs - The cooldown duration in milliseconds.
|
|
26
|
+
* @returns `true` if the cooldown period has elapsed, otherwise `false`.
|
|
27
|
+
*/
|
|
28
|
+
declare function hasCooldownElapsed(startDate: Date, cooldownMs: number): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Converts hours to milliseconds.
|
|
32
|
+
*/
|
|
33
|
+
declare function hoursToMs(hours: number): number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Converts minutes to milliseconds.
|
|
37
|
+
*/
|
|
38
|
+
declare function minutesToMs(minutes: number): number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the name, in Danish language, of the month corresponding to the provided month number.
|
|
42
|
+
*
|
|
43
|
+
* @param month - A month number between 1 and 12.
|
|
44
|
+
*
|
|
45
|
+
* @throws if the provided month number is not a valid month.
|
|
46
|
+
*
|
|
47
|
+
* @example ```ts
|
|
48
|
+
* monthNameDA(9) //=> 'September'
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare function monthNameDa(month: number): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the (Danish) name of the month relative to the current month.
|
|
55
|
+
*
|
|
56
|
+
* @example ```ts
|
|
57
|
+
* // assuming current month is August
|
|
58
|
+
* monthNameDaRelative(-1) //=> 'Juli'
|
|
59
|
+
* monthNameDaRelative(0) //=> 'August'
|
|
60
|
+
* monthNameDaRelative(1) //=> 'September'
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function monthNameDaRelative(n: number): string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Calculates the number of milliseconds that have elapsed since the given date.
|
|
67
|
+
*/
|
|
68
|
+
declare function msSinceDate(date: Date | string | number): number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Converts seconds to milliseconds.
|
|
72
|
+
*/
|
|
73
|
+
declare function secondsToMs(seconds: number): number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Remove the time component from a date, returning only the date part.
|
|
77
|
+
*/
|
|
78
|
+
declare function stripTime(date: Date): Date;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get the UTC date today, time stripped
|
|
82
|
+
*/
|
|
83
|
+
declare function today(): Date;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get the UTC date yesterday, time stripped
|
|
87
|
+
*/
|
|
88
|
+
declare function yesterday(): Date;
|
|
89
|
+
|
|
90
|
+
export { Timer, dateString, daysToMs, getWeek, hasCooldownElapsed, hoursToMs, minutesToMs, monthNameDa, monthNameDaRelative, msSinceDate, secondsToMs, stripTime, today, yesterday };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that returns the elapsed time since invokation.
|
|
3
|
+
*/
|
|
4
|
+
declare function Timer(startTime?: number): (endTime?: number) => string;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reutnrs the date formatted as: yyyy-MM-dd
|
|
8
|
+
*/
|
|
9
|
+
declare function dateString(date?: Date | number | string): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Converts days to milliseconds.
|
|
13
|
+
*/
|
|
14
|
+
declare function daysToMs(days: number): number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the week number of the year for a given date using Danish locale.
|
|
18
|
+
*/
|
|
19
|
+
declare function getWeek(date: Date): number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Determines if a specified cooldown period has elapsed since a given date.
|
|
23
|
+
*
|
|
24
|
+
* @param startDate - The starting date to calculate elapsed time from.
|
|
25
|
+
* @param cooldownMs - The cooldown duration in milliseconds.
|
|
26
|
+
* @returns `true` if the cooldown period has elapsed, otherwise `false`.
|
|
27
|
+
*/
|
|
28
|
+
declare function hasCooldownElapsed(startDate: Date, cooldownMs: number): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Converts hours to milliseconds.
|
|
32
|
+
*/
|
|
33
|
+
declare function hoursToMs(hours: number): number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Converts minutes to milliseconds.
|
|
37
|
+
*/
|
|
38
|
+
declare function minutesToMs(minutes: number): number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the name, in Danish language, of the month corresponding to the provided month number.
|
|
42
|
+
*
|
|
43
|
+
* @param month - A month number between 1 and 12.
|
|
44
|
+
*
|
|
45
|
+
* @throws if the provided month number is not a valid month.
|
|
46
|
+
*
|
|
47
|
+
* @example ```ts
|
|
48
|
+
* monthNameDA(9) //=> 'September'
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare function monthNameDa(month: number): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the (Danish) name of the month relative to the current month.
|
|
55
|
+
*
|
|
56
|
+
* @example ```ts
|
|
57
|
+
* // assuming current month is August
|
|
58
|
+
* monthNameDaRelative(-1) //=> 'Juli'
|
|
59
|
+
* monthNameDaRelative(0) //=> 'August'
|
|
60
|
+
* monthNameDaRelative(1) //=> 'September'
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function monthNameDaRelative(n: number): string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Calculates the number of milliseconds that have elapsed since the given date.
|
|
67
|
+
*/
|
|
68
|
+
declare function msSinceDate(date: Date | string | number): number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Converts seconds to milliseconds.
|
|
72
|
+
*/
|
|
73
|
+
declare function secondsToMs(seconds: number): number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Remove the time component from a date, returning only the date part.
|
|
77
|
+
*/
|
|
78
|
+
declare function stripTime(date: Date): Date;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get the UTC date today, time stripped
|
|
82
|
+
*/
|
|
83
|
+
declare function today(): Date;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get the UTC date yesterday, time stripped
|
|
87
|
+
*/
|
|
88
|
+
declare function yesterday(): Date;
|
|
89
|
+
|
|
90
|
+
export { Timer, dateString, daysToMs, getWeek, hasCooldownElapsed, hoursToMs, minutesToMs, monthNameDa, monthNameDaRelative, msSinceDate, secondsToMs, stripTime, today, yesterday };
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { ms } from 'enhanced-ms';
|
|
2
|
+
import { format, getWeek as getWeek$1, addMonths, subDays } from 'date-fns';
|
|
3
|
+
import { da } from 'date-fns/locale';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
function Timer(startTime = Date.now()) {
|
|
8
|
+
return function(endTime = Date.now()) {
|
|
9
|
+
const duration = endTime - startTime;
|
|
10
|
+
if (duration === 0) {
|
|
11
|
+
return "0ms";
|
|
12
|
+
}
|
|
13
|
+
const string = ms(duration, {
|
|
14
|
+
useAbbreviations: true
|
|
15
|
+
});
|
|
16
|
+
return string ?? `${duration}ms`;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
__name(Timer, "Timer");
|
|
20
|
+
function dateString(date) {
|
|
21
|
+
return format(date ? new Date(date) : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
22
|
+
}
|
|
23
|
+
__name(dateString, "dateString");
|
|
24
|
+
|
|
25
|
+
// src/daysToMs.ts
|
|
26
|
+
function daysToMs(days) {
|
|
27
|
+
return 1e3 * 60 * 60 * 24 * days;
|
|
28
|
+
}
|
|
29
|
+
__name(daysToMs, "daysToMs");
|
|
30
|
+
function getWeek(date) {
|
|
31
|
+
return getWeek$1(date, {
|
|
32
|
+
locale: da
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
__name(getWeek, "getWeek");
|
|
36
|
+
|
|
37
|
+
// src/hasCooldownElapsed.ts
|
|
38
|
+
function hasCooldownElapsed(startDate, cooldownMs) {
|
|
39
|
+
const elapsedMs = Date.now() - startDate.getTime();
|
|
40
|
+
return elapsedMs > cooldownMs;
|
|
41
|
+
}
|
|
42
|
+
__name(hasCooldownElapsed, "hasCooldownElapsed");
|
|
43
|
+
|
|
44
|
+
// src/hoursToMs.ts
|
|
45
|
+
function hoursToMs(hours) {
|
|
46
|
+
return 1e3 * 60 * 60 * hours;
|
|
47
|
+
}
|
|
48
|
+
__name(hoursToMs, "hoursToMs");
|
|
49
|
+
|
|
50
|
+
// src/minutesToMs.ts
|
|
51
|
+
function minutesToMs(minutes) {
|
|
52
|
+
return 1e3 * 60 * minutes;
|
|
53
|
+
}
|
|
54
|
+
__name(minutesToMs, "minutesToMs");
|
|
55
|
+
|
|
56
|
+
// src/monthNameDa.ts
|
|
57
|
+
function monthNameDa(month) {
|
|
58
|
+
if (month < 1 || month > 12) {
|
|
59
|
+
throw new Error(`Invalid month number. Got: ${month}`);
|
|
60
|
+
}
|
|
61
|
+
return MONTH_NAMES_DA[month];
|
|
62
|
+
}
|
|
63
|
+
__name(monthNameDa, "monthNameDa");
|
|
64
|
+
var MONTH_NAMES_DA = [
|
|
65
|
+
"",
|
|
66
|
+
"Januar",
|
|
67
|
+
"Februar",
|
|
68
|
+
"Marts",
|
|
69
|
+
"April",
|
|
70
|
+
"Maj",
|
|
71
|
+
"Juni",
|
|
72
|
+
"Juli",
|
|
73
|
+
"August",
|
|
74
|
+
"September",
|
|
75
|
+
"Oktober",
|
|
76
|
+
"November",
|
|
77
|
+
"December"
|
|
78
|
+
];
|
|
79
|
+
function monthNameDaRelative(n) {
|
|
80
|
+
return monthNameDa(addMonths(/* @__PURE__ */ new Date(), n).getUTCMonth() + 1);
|
|
81
|
+
}
|
|
82
|
+
__name(monthNameDaRelative, "monthNameDaRelative");
|
|
83
|
+
|
|
84
|
+
// src/msSinceDate.ts
|
|
85
|
+
function msSinceDate(date) {
|
|
86
|
+
return Date.now() - new Date(date).getTime();
|
|
87
|
+
}
|
|
88
|
+
__name(msSinceDate, "msSinceDate");
|
|
89
|
+
|
|
90
|
+
// src/secondsToMs.ts
|
|
91
|
+
function secondsToMs(seconds) {
|
|
92
|
+
return 1e3 * seconds;
|
|
93
|
+
}
|
|
94
|
+
__name(secondsToMs, "secondsToMs");
|
|
95
|
+
|
|
96
|
+
// src/stripTime.ts
|
|
97
|
+
function stripTime(date) {
|
|
98
|
+
return new Date(date.toISOString().slice(0, 10));
|
|
99
|
+
}
|
|
100
|
+
__name(stripTime, "stripTime");
|
|
101
|
+
|
|
102
|
+
// src/today.ts
|
|
103
|
+
function today() {
|
|
104
|
+
return stripTime(new Date(Date.now()));
|
|
105
|
+
}
|
|
106
|
+
__name(today, "today");
|
|
107
|
+
function yesterday() {
|
|
108
|
+
return stripTime(subDays(today(), 1));
|
|
109
|
+
}
|
|
110
|
+
__name(yesterday, "yesterday");
|
|
111
|
+
|
|
112
|
+
export { Timer, dateString, daysToMs, getWeek, hasCooldownElapsed, hoursToMs, minutesToMs, monthNameDa, monthNameDaRelative, msSinceDate, secondsToMs, stripTime, today, yesterday };
|