bfg-common 1.4.272 → 1.4.273

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.
@@ -124,6 +124,29 @@ const userNameErrorText = computed<string>(() => {
124
124
  const frequencyMethodOptions = computed<UI_I_SelectInputItem[]>(() =>
125
125
  frequencyMethodFunc(localization.value)
126
126
  )
127
+
128
+ watch(
129
+ model,
130
+ (newValue: UI_I_ScheduleNewTasksForm) => {
131
+ console.log(newValue, '444444')
132
+ const date = newValue.frg_on_time && new Date(newValue.frg_on_time)
133
+ newValue.cron = generateOnceCronExpression(date)
134
+ },
135
+ { deep: true }
136
+ )
137
+
138
+ const generateOnceCronExpression = (date: Date | null): any => {
139
+ if(!date) return
140
+ const minutes = date.getMinutes()
141
+ const hours = date.getHours()
142
+ const day = date.getDate()
143
+ const month = date.getMonth() + 1 // В cron месяцы начинаются с 1 (январь = 1)
144
+ const dayOfWeek = '*' // Для одноразовой задачи день недели неважен
145
+
146
+ // Генерируем cron-выражение
147
+ const cronExpression = `${minutes} ${hours} ${day} ${month} ${dayOfWeek} once`
148
+ return cronExpression
149
+ }
127
150
  </script>
128
151
 
129
152
  <style lang="scss" scoped>
@@ -16,4 +16,5 @@ export interface UI_I_ScheduleNewTasksForm {
16
16
  frq_week_day: UI_T_FrequencyWeeksDays
17
17
  frg_on_time: number | null
18
18
  frg_on_week_days: number[]
19
+ cron: string
19
20
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.272",
4
+ "version": "1.4.273",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",