Skip to content

Commit 047fba7

Browse files
authored
fix(scheduling): [MC-1554] Fix same day scheduling from Schedule view (#1220)
- Updated validation rules for `scheduledDate` to evaluate today's timestamp that is the equivalent of the start of the day, and not any random time that occasionally prevented curators from schedulind. - Updated validation messages to provide feedback to users when form validation fails. - Removed an outdated prospect source from tests.
1 parent 042686c commit 047fba7

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/curated-corpus/components/ScheduleItemForm/ScheduleItemForm.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('The ScheduleItemForm component', () => {
1919
prospectTypes: [
2020
ProspectType.Timespent,
2121
ProspectType.TopSaved,
22-
ProspectType.SyndicatedNew,
22+
ProspectType.PublisherSubmitted,
2323
],
2424
},
2525
{

src/curated-corpus/components/ScheduleItemForm/ScheduleItemForm.validation.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,18 @@ export const getValidationSchema = (
3535

3636
scheduledDate: yup
3737
.date()
38-
.min(DateTime.local())
39-
.max(DateTime.local().plus({ days: 60 }))
40-
.required('Please choose a date no more than 60 days in advance.')
38+
.min(
39+
// Rewind back to the start of the day locally so that curators
40+
// are not unintentionally prevented from scheduling stories
41+
// for the current date.
42+
DateTime.local().startOf('day'),
43+
'Stories cannot be scheduled in the past.',
44+
)
45+
.max(
46+
DateTime.local().plus({ days: 60 }),
47+
'Please choose a date no more than 60 days in advance.',
48+
)
49+
.required('This field is required.')
4150
.nullable(),
4251

4352
[ManualScheduleReason.Evergreen]: yup.boolean(),

0 commit comments

Comments
 (0)