Skip to content

Commit

Permalink
add timezone guess to create new engagement (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanoy authored Jun 3, 2022
1 parent ea275ec commit 793c3b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ describe('Create New Engagement Route', () => {
engagement_region: 'dev-1',
engagement_type: 'Residency',
project_name: 'Mars Rover',
timezone: 'America/New_York',
});
});
});
Expand Down
9 changes: 9 additions & 0 deletions src/routes/create_new_engagement/create_new_engagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export function CreateNewEngagementForm() {
const { logEvent } = useAnalytics();
let uuid = null;

const getTimeZone = () => {
try {
return Intl.DateTimeFormat().resolvedOptions().timeZone;
} catch (e) {
return 'Europe/London';
}
};

useEffect(() => {
setCopiedEngagement(
findEngagementToCopy(engagements, selectedProjectNameToFind)
Expand Down Expand Up @@ -107,6 +115,7 @@ export function CreateNewEngagementForm() {
engagementFormConfig?.basic_information?.engagement_types?.options?.find?.(
e => e.default
)?.value,
timezone: getTimeZone(),
});
uuid = result.uuid;
}
Expand Down

0 comments on commit 793c3b2

Please sign in to comment.