Fix for 'Run on' field in frequency details

This commit is contained in:
Vidya Nambiar
2023-05-01 17:03:51 -04:00
parent eb7407593f
commit b7c5cbac3f

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 (