bfg-common 1.4.263 → 1.4.264
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBefore, parseISO,
|
|
1
|
+
import { isBefore, parseISO, subMinutes } from 'date-fns'
|
|
2
2
|
import type {
|
|
3
3
|
UI_I_Localization,
|
|
4
4
|
UI_I_ArbitraryObject,
|
|
@@ -89,10 +89,12 @@ export const validateDate = (
|
|
|
89
89
|
date: string,
|
|
90
90
|
_predefinedDate?: string
|
|
91
91
|
): string => {
|
|
92
|
-
const currentDateTime =
|
|
93
|
-
const
|
|
92
|
+
const currentDateTime = new Date()
|
|
93
|
+
const thresholdDate = subMinutes(currentDateTime, 4) // Используем date-fns для вычитания 4 минут
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
const selectedDate = parseISO(date) // Начало дня выбранной даты theValueLargeThanStartTime
|
|
96
|
+
|
|
97
|
+
return isBefore(selectedDate, thresholdDate)
|
|
96
98
|
? localization.common.theValueTooSmall
|
|
97
99
|
: ''
|
|
98
100
|
}
|