Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance date and time format settings to reflect system preferences #7274

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

angelali314159
Copy link
Contributor

@angelali314159 angelali314159 commented Sep 26, 2024

Closes #6880

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This pull request enhances date and time format settings to reflect system preferences, improving user experience in the profile appearance settings.

  • Added detectSystemDateFormat function in DateTimeSettingsDateFormatSelect.tsx to display system's date format
  • Implemented is12HourFormat function in DateTimeSettingsTimeFormatSelect.tsx to show current time in system format
  • Introduced getSystemTimeZoneOption in DateTimeSettingsTimeZoneSelect.tsx to detect and display system time zone
  • Updated Select components in all three files to show more informative system setting options
  • Improved value handling in DateTimeSettingsTimeZoneSelect.tsx for direct passing to Select component

3 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

Comment on lines 20 to 23
const is12HourFormat = (timeZone: string): boolean => {
const formattedTime = formatInTimeZone(new Date(), timeZone, 'hh:mm a');
return formattedTime.includes('AM') || formattedTime.includes('PM');
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider caching the result of is12HourFormat to avoid unnecessary calculations on each render

Comment on lines 33 to 34
label: `System settings - ${systemTimeZoneOption?.label}`,
value: 'system',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Handle potential undefined systemTimeZoneOption

@angelali314159
Copy link
Contributor Author

angelali314159 commented Sep 26, 2024

Hi! I was just working on this issue: #6880

I made the page reflect the wanted format:
image

Sorry, this is my first time contributing to an open source and I wasn't sure how to submit this with the pull request. It worked well locally though!

@thomtrp thomtrp assigned thomtrp and unassigned thomtrp Sep 30, 2024
@lucasbordeau lucasbordeau self-assigned this Oct 9, 2024
Copy link
Contributor

@lucasbordeau lucasbordeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good approach I just replaced the new utils with the existing utils we already have for that.

@lucasbordeau lucasbordeau merged commit 28c0b14 into twentyhq:main Oct 9, 2024
11 checks passed
harshit078 pushed a commit to harshit078/twenty that referenced this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Date & Time default value placeholders
3 participants