fix(user-profile): respect 24-hour clock setting for local time (#1579)

<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->

### Description

Fixes an inconsistency where a user profile's local time did not respect
the "24-Hour Time Format" setting. This was just a small annoyance I
noticed, therefore there is no corresponding issue.

#### Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] ~~I have commented my code, particularly in hard-to-understand
areas~~ Does not apply
- [ ] ~~I have made corresponding changes to the documentation~~ Does
not apply
- [x] My changes generate no new warnings

### AI disclosure:

No artificial intelligence tools have been used while making this patch.

- [ ] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->
This commit is contained in:
Erwan Leboucher authored and GitHub committed 2026-08-02 17:46:36 +00:00
commit 51b36688fa
2 files changed
+9 -1

No files matched your search

@@ -0,0 +1,5 @@
---
default: patch
---
# Fix an inconsistency where a user profile's local time did not respect the "24-Hour Time Format" setting
@@ -106,6 +106,8 @@ function UserExtendedSection({
const [miscDataIndex, setMiscDataIndex] = useState(-1);
const [renderAnimals] = useSetting(settingsAtom, 'renderAnimals');
const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock');
const isCat = profile.isCat === true;
const hasCats = profile.hasCats === true;
const isAnimal = profile.isAnimal ?? (isCat && 'cat');
@@ -139,11 +141,12 @@ function UserExtendedSection({
hour: 'numeric',
minute: '2-digit',
timeZone: profile.timezone.replaceAll(/^["']|["']$/g, ''),
hour12: !hour24Clock,
}).format(new Date());
} catch {
return null;
}
}, [profile.timezone]);
}, [profile.timezone, hour24Clock]);
const bioContent = useMemo(() => {
let rawBio =