Skip to content

Commit

Permalink
fix(scheduling): [MC-1554] Fix same day scheduling from Schedule view (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
nina-py authored Oct 3, 2024
1 parent 042686c commit 047fba7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('The ScheduleItemForm component', () => {
prospectTypes: [
ProspectType.Timespent,
ProspectType.TopSaved,
ProspectType.SyndicatedNew,
ProspectType.PublisherSubmitted,
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ export const getValidationSchema = (

scheduledDate: yup
.date()
.min(DateTime.local())
.max(DateTime.local().plus({ days: 60 }))
.required('Please choose a date no more than 60 days in advance.')
.min(
// Rewind back to the start of the day locally so that curators
// are not unintentionally prevented from scheduling stories
// for the current date.
DateTime.local().startOf('day'),
'Stories cannot be scheduled in the past.',
)
.max(
DateTime.local().plus({ days: 60 }),
'Please choose a date no more than 60 days in advance.',
)
.required('This field is required.')
.nullable(),

[ManualScheduleReason.Evergreen]: yup.boolean(),
Expand Down

0 comments on commit 047fba7

Please sign in to comment.