Fix interpretation of day of week in automation form

This commit is contained in:
sabaimran 2024-07-16 10:12:30 +05:30
parent c837f3779e
commit 1a5405e24c

View file

@ -83,6 +83,7 @@ function getEveryBlahFromCron(cron: string) {
function getDayOfWeekFromCron(cron: string) { function getDayOfWeekFromCron(cron: string) {
const cronParts = cron.split(' '); const cronParts = cron.split(' ');
console.log(cronParts);
if (cronParts[3] === '*' && cronParts[4] !== '*') { if (cronParts[3] === '*' && cronParts[4] !== '*') {
return Number(cronParts[4]); return Number(cronParts[4]);
} }
@ -631,7 +632,7 @@ function AutomationModificationForm(props: AutomationModificationFormProps) {
<FormItem <FormItem
className='w-full'> className='w-full'>
<FormLabel>Day of Week</FormLabel> <FormLabel>Day of Week</FormLabel>
<Select onValueChange={field.onChange} defaultValue={String(field.value)}> <Select onValueChange={(value) => field.onChange(Number(value))} defaultValue={String(field.value)}>
<FormControl> <FormControl>
<SelectTrigger className='w-[200px]'> <SelectTrigger className='w-[200px]'>
On <SelectValue placeholder="" /> On <SelectValue placeholder="" />