Changeset View
Changeset View
Standalone View
Standalone View
lib/types/entry-types.js
// @flow | // @flow | ||||
import type { Platform } from './device-types.js'; | import { type Platform, isWebPlatform } from './device-types.js'; | ||||
import { type CalendarFilter, defaultCalendarFilters } from './filter-types.js'; | import { type CalendarFilter, defaultCalendarFilters } from './filter-types.js'; | ||||
import type { RawMessageInfo } from './message-types.js'; | import type { RawMessageInfo } from './message-types.js'; | ||||
import type { | import type { | ||||
ServerCreateUpdatesResponse, | ServerCreateUpdatesResponse, | ||||
ClientCreateUpdatesResponse, | ClientCreateUpdatesResponse, | ||||
} from './update-types.js'; | } from './update-types.js'; | ||||
import type { UserInfo, AccountUserInfo } from './user-types.js'; | import type { UserInfo, AccountUserInfo } from './user-types.js'; | ||||
import { | import { | ||||
Show All 39 Lines | export type CalendarQuery = { | ||||
+endDate: string, | +endDate: string, | ||||
+filters: $ReadOnlyArray<CalendarFilter>, | +filters: $ReadOnlyArray<CalendarFilter>, | ||||
}; | }; | ||||
export const defaultCalendarQuery = ( | export const defaultCalendarQuery = ( | ||||
platform: ?Platform, | platform: ?Platform, | ||||
timeZone?: ?string, | timeZone?: ?string, | ||||
): CalendarQuery => { | ): CalendarQuery => { | ||||
if (platform === 'web') { | if (isWebPlatform(platform)) { | ||||
return { | return { | ||||
...thisMonthDates(timeZone), | ...thisMonthDates(timeZone), | ||||
filters: defaultCalendarFilters, | filters: defaultCalendarFilters, | ||||
}; | }; | ||||
} else { | } else { | ||||
return { | return { | ||||
startDate: fifteenDaysEarlier(timeZone).valueOf(), | startDate: fifteenDaysEarlier(timeZone).valueOf(), | ||||
endDate: fifteenDaysLater(timeZone).valueOf(), | endDate: fifteenDaysLater(timeZone).valueOf(), | ||||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |