Skip to content

Commit 15ab872

Browse files
committed
fix(scheduling): [MC-1554] Fix same day scheduling from Schedule view
- 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 15ab872

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,17 @@ 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+
DateTime.local().startOf('day'),
42+
'Stories cannot be scheduled in the past.',
43+
)
44+
.max(
45+
DateTime.local().plus({ days: 60 }),
46+
'Please choose a date no more than 60 days in advance.',
47+
)
48+
.required('This field is required.')
4149
.nullable(),
4250

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

0 commit comments

Comments
 (0)