Merge pull request #13941 from vidyanambiar/freq-details

Fix for incorrect value for 'Run on' field in frequency details
This commit is contained in:
Sarah Akus
2023-05-02 13:19:06 -04:00
committed by GitHub

View File

@@ -122,6 +122,18 @@ function sortWeekday(a, b) {
} }
function RunOnDetail({ type, options, prefix }) { function RunOnDetail({ type, options, prefix }) {
const weekdays = {
sunday: t`Sunday`,
monday: t`Monday`,
tuesday: t`Tuesday`,
wednesday: t`Wednesday`,
thursday: t`Thursday`,
friday: t`Friday`,
saturday: t`Saturday`,
day: t`day`,
weekday: t`weekday`,
weekendDay: t`weekend day`,
};
if (type === 'month') { if (type === 'month') {
if (options.runOn === 'day') { if (options.runOn === 'day') {
return ( return (
@@ -132,16 +144,16 @@ function RunOnDetail({ type, options, prefix }) {
/> />
); );
} }
const dayOfWeek = options.runOnTheDay; const dayOfWeek = weekdays[options.runOnTheDay];
return ( return (
<Detail <Detail
label={t`Run on`} label={t`Run on`}
value={ value={
options.runOnDayNumber === -1 ? ( options.runOnTheOccurrence === -1 ? (
t`The last ${dayOfWeek}` t`The last ${dayOfWeek}`
) : ( ) : (
<SelectOrdinal <SelectOrdinal
value={options.runOnDayNumber} value={options.runOnTheOccurrence}
one={`The first ${dayOfWeek}`} one={`The first ${dayOfWeek}`}
two={`The second ${dayOfWeek}`} two={`The second ${dayOfWeek}`}
_3={`The third ${dayOfWeek}`} _3={`The third ${dayOfWeek}`}
@@ -178,18 +190,6 @@ function RunOnDetail({ type, options, prefix }) {
/> />
); );
} }
const weekdays = {
sunday: t`Sunday`,
monday: t`Monday`,
tuesday: t`Tuesday`,
wednesday: t`Wednesday`,
thursday: t`Thursday`,
friday: t`Friday`,
saturday: t`Saturday`,
day: t`day`,
weekday: t`weekday`,
weekendDay: t`weekend day`,
};
const weekday = weekdays[options.runOnTheDay]; const weekday = weekdays[options.runOnTheDay];
const month = months[options.runOnTheMonth]; const month = months[options.runOnTheMonth];
return ( return (