@bemoje/date 1.0.1 → 1.1.1
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/Timer.cjs +21 -0
- package/lib/Timer.d.cts +6 -0
- package/lib/Timer.d.ts +6 -0
- package/lib/Timer.js +19 -0
- package/lib/dateString.cjs +12 -0
- package/lib/dateString.d.cts +6 -0
- package/lib/dateString.d.ts +6 -0
- package/lib/dateString.js +10 -0
- package/lib/daysToMs.cjs +12 -0
- package/lib/daysToMs.d.cts +6 -0
- package/lib/daysToMs.d.ts +6 -0
- package/lib/daysToMs.js +10 -0
- package/lib/getWeek.cjs +15 -0
- package/lib/getWeek.d.cts +6 -0
- package/lib/getWeek.d.ts +6 -0
- package/lib/getWeek.js +13 -0
- package/lib/hasCooldownElapsed.cjs +13 -0
- package/lib/hasCooldownElapsed.d.cts +10 -0
- package/lib/hasCooldownElapsed.d.ts +10 -0
- package/lib/hasCooldownElapsed.js +11 -0
- package/lib/hoursToMs.cjs +12 -0
- package/lib/hoursToMs.d.cts +6 -0
- package/lib/hoursToMs.d.ts +6 -0
- package/lib/hoursToMs.js +10 -0
- package/lib/index.cjs +127 -0
- package/lib/index.d.cts +14 -0
- package/lib/index.d.ts +14 -0
- package/lib/minutesToMs.cjs +12 -0
- package/lib/minutesToMs.d.cts +6 -0
- package/lib/minutesToMs.d.ts +6 -0
- package/lib/minutesToMs.js +10 -0
- package/lib/monthNameDa.cjs +30 -0
- package/lib/monthNameDa.d.cts +14 -0
- package/lib/monthNameDa.d.ts +14 -0
- package/lib/monthNameDa.js +28 -0
- package/lib/monthNameDaRelative.cjs +38 -0
- package/lib/monthNameDaRelative.d.cts +13 -0
- package/lib/monthNameDaRelative.d.ts +13 -0
- package/lib/monthNameDaRelative.js +36 -0
- package/lib/msSinceDate.cjs +12 -0
- package/lib/msSinceDate.d.cts +6 -0
- package/lib/msSinceDate.d.ts +6 -0
- package/lib/msSinceDate.js +10 -0
- package/lib/secondsToMs.cjs +12 -0
- package/lib/secondsToMs.d.cts +6 -0
- package/lib/secondsToMs.d.ts +6 -0
- package/lib/secondsToMs.js +10 -0
- package/lib/stripTime.cjs +12 -0
- package/lib/stripTime.d.cts +6 -0
- package/lib/stripTime.d.ts +6 -0
- package/lib/stripTime.js +10 -0
- package/lib/today.cjs +18 -0
- package/lib/today.d.cts +6 -0
- package/lib/today.d.ts +6 -0
- package/lib/today.js +16 -0
- package/lib/yesterday.cjs +26 -0
- package/lib/yesterday.d.cts +6 -0
- package/lib/yesterday.d.ts +6 -0
- package/lib/yesterday.js +24 -0
- package/package.json +236 -19
- package/index.d.ts +0 -90
- /package/{index.mjs → lib/index.js} +0 -0
package/lib/Timer.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var enhancedMs = require('enhanced-ms');
|
|
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 = enhancedMs.ms(duration, {
|
|
14
|
+
useAbbreviations: true
|
|
15
|
+
});
|
|
16
|
+
return string ?? `${duration}ms`;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
__name(Timer, "Timer");
|
|
20
|
+
|
|
21
|
+
exports.Timer = Timer;
|
package/lib/Timer.d.cts
ADDED
package/lib/Timer.d.ts
ADDED
package/lib/Timer.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ms } from 'enhanced-ms';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
function Timer(startTime = Date.now()) {
|
|
6
|
+
return function(endTime = Date.now()) {
|
|
7
|
+
const duration = endTime - startTime;
|
|
8
|
+
if (duration === 0) {
|
|
9
|
+
return "0ms";
|
|
10
|
+
}
|
|
11
|
+
const string = ms(duration, {
|
|
12
|
+
useAbbreviations: true
|
|
13
|
+
});
|
|
14
|
+
return string ?? `${duration}ms`;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
__name(Timer, "Timer");
|
|
18
|
+
|
|
19
|
+
export { Timer };
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
function dateString(date) {
|
|
8
|
+
return dateFns.format(date ? new Date(date) : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
9
|
+
}
|
|
10
|
+
__name(dateString, "dateString");
|
|
11
|
+
|
|
12
|
+
exports.dateString = dateString;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { format } from 'date-fns';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
function dateString(date) {
|
|
6
|
+
return format(date ? new Date(date) : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
7
|
+
}
|
|
8
|
+
__name(dateString, "dateString");
|
|
9
|
+
|
|
10
|
+
export { dateString };
|
package/lib/daysToMs.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/daysToMs.ts
|
|
7
|
+
function daysToMs(days) {
|
|
8
|
+
return 1e3 * 60 * 60 * 24 * days;
|
|
9
|
+
}
|
|
10
|
+
__name(daysToMs, "daysToMs");
|
|
11
|
+
|
|
12
|
+
exports.daysToMs = daysToMs;
|
package/lib/daysToMs.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/daysToMs.ts
|
|
5
|
+
function daysToMs(days) {
|
|
6
|
+
return 1e3 * 60 * 60 * 24 * days;
|
|
7
|
+
}
|
|
8
|
+
__name(daysToMs, "daysToMs");
|
|
9
|
+
|
|
10
|
+
export { daysToMs };
|
package/lib/getWeek.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var locale = require('date-fns/locale');
|
|
4
|
+
var dateFns = require('date-fns');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
function getWeek(date) {
|
|
9
|
+
return dateFns.getWeek(date, {
|
|
10
|
+
locale: locale.da
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
__name(getWeek, "getWeek");
|
|
14
|
+
|
|
15
|
+
exports.getWeek = getWeek;
|
package/lib/getWeek.d.ts
ADDED
package/lib/getWeek.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
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 };
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
package/lib/hoursToMs.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var enhancedMs = require('enhanced-ms');
|
|
4
|
+
var dateFns = require('date-fns');
|
|
5
|
+
var locale = require('date-fns/locale');
|
|
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");
|
|
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");
|
|
38
|
+
|
|
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
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Timer } from './Timer.cjs';
|
|
2
|
+
export { dateString } from './dateString.cjs';
|
|
3
|
+
export { daysToMs } from './daysToMs.cjs';
|
|
4
|
+
export { getWeek } from './getWeek.cjs';
|
|
5
|
+
export { hasCooldownElapsed } from './hasCooldownElapsed.cjs';
|
|
6
|
+
export { hoursToMs } from './hoursToMs.cjs';
|
|
7
|
+
export { minutesToMs } from './minutesToMs.cjs';
|
|
8
|
+
export { monthNameDa } from './monthNameDa.cjs';
|
|
9
|
+
export { monthNameDaRelative } from './monthNameDaRelative.cjs';
|
|
10
|
+
export { msSinceDate } from './msSinceDate.cjs';
|
|
11
|
+
export { secondsToMs } from './secondsToMs.cjs';
|
|
12
|
+
export { stripTime } from './stripTime.cjs';
|
|
13
|
+
export { today } from './today.cjs';
|
|
14
|
+
export { yesterday } from './yesterday.cjs';
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Timer } from './Timer.js';
|
|
2
|
+
export { dateString } from './dateString.js';
|
|
3
|
+
export { daysToMs } from './daysToMs.js';
|
|
4
|
+
export { getWeek } from './getWeek.js';
|
|
5
|
+
export { hasCooldownElapsed } from './hasCooldownElapsed.js';
|
|
6
|
+
export { hoursToMs } from './hoursToMs.js';
|
|
7
|
+
export { minutesToMs } from './minutesToMs.js';
|
|
8
|
+
export { monthNameDa } from './monthNameDa.js';
|
|
9
|
+
export { monthNameDaRelative } from './monthNameDaRelative.js';
|
|
10
|
+
export { msSinceDate } from './msSinceDate.js';
|
|
11
|
+
export { secondsToMs } from './secondsToMs.js';
|
|
12
|
+
export { stripTime } from './stripTime.js';
|
|
13
|
+
export { today } from './today.js';
|
|
14
|
+
export { yesterday } from './yesterday.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
|
@@ -0,0 +1,30 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 };
|
|
@@ -0,0 +1,14 @@
|
|
|
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 };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 };
|
|
@@ -0,0 +1,38 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|