-
Notifications
You must be signed in to change notification settings - Fork 9
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
12h default time format #858
Conversation
|
||
# revision identifiers, used by Alembic. | ||
revision = '330fdd8cd0f8' | ||
down_revision = '16c0299eff23' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the last revision id from #854, so when both are merged, there shouldn't be conflicts about branching revision numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm running that now.
(user?.settings?.colourScheme === 'dark' | ||
|| (user?.settings?.colourScheme === 'system' && browserPrefersDark) | ||
|| (!user?.settings?.colourScheme && browserPrefersDark)) | ||
(user.settings?.colourScheme === 'dark' | ||
|| (user.settings?.colourScheme === 'system' && browserPrefersDark) | ||
|| (!user.settings?.colourScheme && browserPrefersDark)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we can't use TS at this place (or do we?), so we can't imply types here. But the user object is always to be expected, so I removed those first question marks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, we should remove this and just default to system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I can remove that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, actually we currently need that to apply the user settings on a fresh page reload. Also this ensures no "flashing" if the user setting differs from the system theme. I would leave it like this for now.
const format = Number(user?.setttings?.timeFormat ?? is12HourTime); | ||
const user = JSON.parse(localStorage?.getItem('tba/user') ?? '{}') as User; | ||
const detected = Intl.DateTimeFormat().resolvedOptions().hour12 ? 12 : 24; | ||
const format = Number(user.settings?.timeFormat ?? detected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual fix. A typo. What else. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find @devmount! \o/
Pulled the branch and tried it out, works great for me locally.
There is one frontend linting warning (it was attached automatically to your PR) or you can also see it here.
Thanks!
Thanks Rob!
Yes I saw that, the App.vue contains a function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks looks good!
(user?.settings?.colourScheme === 'dark' | ||
|| (user?.settings?.colourScheme === 'system' && browserPrefersDark) | ||
|| (!user?.settings?.colourScheme && browserPrefersDark)) | ||
(user.settings?.colourScheme === 'dark' | ||
|| (user.settings?.colourScheme === 'system' && browserPrefersDark) | ||
|| (!user.settings?.colourScheme && browserPrefersDark)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, we should remove this and just default to system.
Description of the Change
This PR fixes a bug, were the user setting for the time format didn't apply correctly. Also, h12 is set now as a new default.
Tip
I already took PR #854 into account for db migrations, although it is not merged yet.
Applicable Issues
Closes #850