bfg-common 1.4.259 → 1.4.261

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.
@@ -2209,6 +2209,7 @@
2209
2209
  "resetToDefault": "Скінуць да стандартных",
2210
2210
  "theValueTooLarge": "Значэнне можа быць занадта вялікім",
2211
2211
  "theValueTooSmall": "Значэнне можа быць занадта малым",
2212
+ "theValueLargeThanStartTime": "Значэнне павінна быць больш, чым час пачатку",
2212
2213
  "closed": "Закрыты"
2213
2214
  },
2214
2215
  "auth": {
@@ -2213,6 +2213,7 @@
2213
2213
  "resetToDefault": "Reset To Default",
2214
2214
  "theValueTooLarge": "The value may be too large",
2215
2215
  "theValueTooSmall": "The value may be too small",
2216
+ "theValueLargeThanStartTime": "The value should be large than start time",
2216
2217
  "closed": "Closed"
2217
2218
  },
2218
2219
  "auth": {
@@ -2213,6 +2213,7 @@
2213
2213
  "resetToDefault": "Վերականգնել լռելյայնին",
2214
2214
  "theValueTooLarge": "Արժեքը կարող է չափազանց մեծ լինել",
2215
2215
  "theValueTooSmall": "Արժեքը կարող է չափազանց փոքր լինել",
2216
+ "theValueLargeThanStartTime": "Արժեքը պետք է մեծ լինի, քան մեկնարկի ժամանակը",
2216
2217
  "closed": "Փակված է"
2217
2218
  },
2218
2219
  "auth": {
@@ -2212,6 +2212,7 @@
2212
2212
  "resetToDefault": "Әдепкіге қайта орнату",
2213
2213
  "theValueTooLarge": "Мән тым үлкен болуы мүмкін",
2214
2214
  "theValueTooSmall": "Мән тым аз болуы мүмкін",
2215
+ "theValueLargeThanStartTime": "Мән басталу уақытынан үлкен болуы керек",
2215
2216
  "closed": "Жабық"
2216
2217
  },
2217
2218
  "auth": {
@@ -2215,6 +2215,7 @@
2215
2215
  "resetToDefault": "Сбросить настройки по умолчанию",
2216
2216
  "theValueTooLarge": "Значение может быть слишком большим",
2217
2217
  "theValueTooSmall": "Значение может быть слишком маленьким",
2218
+ "theValueLargeThanStartTime": "Значение должно быть больше времени начала.",
2218
2219
  "closed": "Закрыто"
2219
2220
  },
2220
2221
  "auth": {
@@ -2211,6 +2211,7 @@
2211
2211
  "resetToDefault": "重置为默认值",
2212
2212
  "theValueTooLarge": "该值可能太大",
2213
2213
  "theValueTooSmall": "该值可能太小",
2214
+ "theValueLargeThanStartTime": "该值应该大于开始时间",
2214
2215
  "closed": "关闭"
2215
2216
  },
2216
2217
  "auth": {
@@ -1,3 +1,4 @@
1
+ import { isBefore, startOfDay } from 'date-fns'
1
2
  import type {
2
3
  UI_I_Localization,
3
4
  UI_I_ArbitraryObject,
@@ -83,3 +84,14 @@ export const validateField = (
83
84
 
84
85
  return ''
85
86
  }
87
+ export const validateDate = (
88
+ localization: UI_I_Localization,
89
+ date: string
90
+ ): string => {
91
+ const currentDateTime = startOfDay(new Date())
92
+ const selectedDate = startOfDay(new Date(date)) // Начало дня выбранной даты
93
+
94
+ return isBefore(selectedDate, currentDateTime)
95
+ ? localization.common.theValueLargeThanStartTime
96
+ : ''
97
+ }
@@ -95,14 +95,18 @@
95
95
  </template>
96
96
 
97
97
  <script lang="ts" setup>
98
+ import { format } from 'date-fns'
98
99
  import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
99
100
  import type { UI_I_Localization } from '~/lib/models/interfaces'
100
101
  import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
101
102
  import {
102
- frequencyOnWeeksDaysFunc,
103
103
  frequencyOnOrdinalNumberFunc,
104
+ frequencyOnWeeksDaysFunc,
104
105
  } from '~/components/common/pages/scheduledTasks/modals/common/frequency/on/lib/config/options'
105
- import { validateField } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
106
+ import {
107
+ validateDate,
108
+ validateField,
109
+ } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
106
110
 
107
111
  const props = defineProps<{
108
112
  type: string
@@ -110,7 +114,6 @@ const props = defineProps<{
110
114
  const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
111
115
 
112
116
  const localization = computed<UI_I_Localization>(() => useLocal())
113
- const { $store, $formattedDate, $isDate, $getUnixByDate }: any = useNuxtApp()
114
117
 
115
118
  const selectedTimeMode = ref<'day' | 'week'>('day')
116
119
 
@@ -144,7 +147,9 @@ watch(
144
147
  )
145
148
 
146
149
  const schedulerAtOnceErrorText = computed<string>(() => {
147
- return !model.value.frg_on_time ? localization.value.common.fieldRequired : ''
150
+ return !model.value.frg_on_time
151
+ ? localization.value.common.fieldRequired
152
+ : validateDate(localization.value, model.value.frg_on_time)
148
153
  })
149
154
  watch(
150
155
  schedulerAtOnceErrorText,
@@ -154,23 +159,13 @@ watch(
154
159
  { immediate: true }
155
160
  )
156
161
 
157
- // const calendarDefaultDate = ref<number>(new Date().getTime())
158
- // const currentDateLocal = ref<string>('')
159
-
160
- // const language = computed<string>(() => $store.getters['main/getInterfaceLang'])
161
- // const onUpdateDateTo = (val: number): void => {
162
- // if (!val) return
163
- //
164
- // model.value.frg_on_time = val // milliseconds
165
- //
166
- // currentDateLocal.value = $formattedDate(new Date(val), 'MM.dd.yyyy, hh:mm')
167
- // }
168
-
169
- // watch(currentDateLocal, (newValue) => {
170
- // $isDate(newValue) &&
171
- // (calendarDefaultDate.value = model.value.frg_on_time =
172
- // $getUnixByDate(newValue))
173
- // })
162
+ onMounted(() => {
163
+ props.type === 'once' && setDefaultDateTime()
164
+ })
165
+ const setDefaultDateTime = () => {
166
+ const currentDateTime = new Date()
167
+ model.value.frg_on_time = format(currentDateTime, "yyyy-MM-dd'T'HH:mm")
168
+ }
174
169
  </script>
175
170
 
176
171
  <style lang="scss" scoped>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.259",
4
+ "version": "1.4.261",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",