1 import { c } from 'ttag';
3 import { AutoReplyDuration } from '@proton/shared/lib/constants';
5 export const getDurationOptions = () => [
7 text: c('Option').t`Fixed duration`,
8 value: AutoReplyDuration.FIXED,
11 text: c('Option').t`Repeat daily`,
12 value: AutoReplyDuration.DAILY,
15 text: c('Option').t`Repeat weekly`,
16 value: AutoReplyDuration.WEEKLY,
19 text: c('Option').t`Repeat monthly`,
20 value: AutoReplyDuration.MONTHLY,
23 text: c('Option').t`Permanent`,
24 value: AutoReplyDuration.PERMANENT,
28 export const getMatchingTimezone = (timezone: string, timezoneOptions: { text: string; value: string }[]) => {
30 timezoneOptions.find(({ value }) => {
31 return value === timezone;
32 // Can be stored as "Singapore", now expecting Asia/Singapore
34 timezoneOptions.find(({ value }) => {
35 return value.includes(timezone);
42 * Get a list with the days of the month and their
43 * index position (in the week) according to current locale
45 * @return {Object} [{ text: 'name of day', value: index position in week }]
47 export const getDaysOfMonthOptions = () => [
48 { text: c('Option').t`1st of the month`, value: 0 },
49 { text: c('Option').t`2nd of the month`, value: 1 },
50 { text: c('Option').t`3rd of the month`, value: 2 },
51 { text: c('Option').t`4th of the month`, value: 3 },
52 { text: c('Option').t`5th of the month`, value: 4 },
53 { text: c('Option').t`6th of the month`, value: 5 },
54 { text: c('Option').t`7th of the month`, value: 6 },
55 { text: c('Option').t`8th of the month`, value: 7 },
56 { text: c('Option').t`9th of the month`, value: 8 },
57 { text: c('Option').t`10th of the month`, value: 9 },
58 { text: c('Option').t`11th of the month`, value: 10 },
59 { text: c('Option').t`12th of the month`, value: 11 },
60 { text: c('Option').t`13th of the month`, value: 12 },
61 { text: c('Option').t`14th of the month`, value: 13 },
62 { text: c('Option').t`15th of the month`, value: 14 },
63 { text: c('Option').t`16th of the month`, value: 15 },
64 { text: c('Option').t`17th of the month`, value: 16 },
65 { text: c('Option').t`18th of the month`, value: 17 },
66 { text: c('Option').t`19th of the month`, value: 18 },
67 { text: c('Option').t`20th of the month`, value: 19 },
68 { text: c('Option').t`21st of the month`, value: 20 },
69 { text: c('Option').t`22nd of the month`, value: 21 },
70 { text: c('Option').t`23rd of the month`, value: 22 },
71 { text: c('Option').t`24th of the month`, value: 23 },
72 { text: c('Option').t`25th of the month`, value: 24 },
73 { text: c('Option').t`26th of the month`, value: 25 },
74 { text: c('Option').t`27th of the month`, value: 26 },
75 { text: c('Option').t`28th of the month`, value: 27 },
76 { text: c('Option').t`29th of the month`, value: 28 },
77 { text: c('Option').t`30th of the month`, value: 29 },
78 { text: c('Option').t`31st of the month`, value: 30 },