@ardium-pl/devkit 8.4.2 → 8.4.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.
|
@@ -2750,12 +2750,27 @@ function coerceDateProperty(v, fallback) {
|
|
|
2750
2750
|
}
|
|
2751
2751
|
function coerceDateOnlyProperty(v, fallback, asUTC = false) {
|
|
2752
2752
|
if (typeof v == 'string') {
|
|
2753
|
-
|
|
2753
|
+
const lower = v.toLowerCase();
|
|
2754
|
+
if (lower === 'now' || lower === 'today') {
|
|
2754
2755
|
const now = new Date();
|
|
2755
|
-
now.
|
|
2756
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
2756
2757
|
return asUTC
|
|
2757
|
-
? getUTCDate(
|
|
2758
|
-
:
|
|
2758
|
+
? getUTCDate(today.getFullYear(), today.getMonth(), today.getDate(), today.getHours(), today.getMinutes(), today.getSeconds(), today.getMilliseconds())
|
|
2759
|
+
: today;
|
|
2760
|
+
}
|
|
2761
|
+
if (lower === 'tomorrow') {
|
|
2762
|
+
const now = new Date();
|
|
2763
|
+
const tomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
|
|
2764
|
+
return asUTC
|
|
2765
|
+
? getUTCDate(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate(), tomorrow.getHours(), tomorrow.getMinutes(), tomorrow.getSeconds(), tomorrow.getMilliseconds())
|
|
2766
|
+
: tomorrow;
|
|
2767
|
+
}
|
|
2768
|
+
if (lower === 'yesterday') {
|
|
2769
|
+
const now = new Date();
|
|
2770
|
+
const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
|
|
2771
|
+
return asUTC
|
|
2772
|
+
? getUTCDate(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate(), yesterday.getHours(), yesterday.getMinutes(), yesterday.getSeconds(), yesterday.getMilliseconds())
|
|
2773
|
+
: yesterday;
|
|
2759
2774
|
}
|
|
2760
2775
|
}
|
|
2761
2776
|
const dateV = new Date(v);
|