Merge pull request 'feat: improved local time display' (#9851) from naskya/calckey:localtime-improvement into develop
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9851
This commit is contained in:
commit
64a737d001
|
@ -1426,7 +1426,7 @@ _profile:
|
||||||
metadataContent: "Content"
|
metadataContent: "Content"
|
||||||
changeAvatar: "Change avatar"
|
changeAvatar: "Change avatar"
|
||||||
changeBanner: "Change banner"
|
changeBanner: "Change banner"
|
||||||
locationDescription: "If you enter your city, it will display your local time to other users."
|
locationDescription: "If you enter your city first, it will display your local time to other users."
|
||||||
_exportOrImport:
|
_exportOrImport:
|
||||||
allNotes: "All posts"
|
allNotes: "All posts"
|
||||||
followingList: "Followed users"
|
followingList: "Followed users"
|
||||||
|
|
|
@ -1423,7 +1423,7 @@ _profile:
|
||||||
metadataContent: "内容"
|
metadataContent: "内容"
|
||||||
changeAvatar: "アバター画像を変更"
|
changeAvatar: "アバター画像を変更"
|
||||||
changeBanner: "バナー画像を変更"
|
changeBanner: "バナー画像を変更"
|
||||||
locationDescription: "正しく入力すると、あなたの現地時間が他のユーザーに表示されます。"
|
locationDescription: "英語表記の都市名から始まる内容を入力すると、現地時間がユーザーページに表示されます。"
|
||||||
_exportOrImport:
|
_exportOrImport:
|
||||||
allNotes: "全ての投稿"
|
allNotes: "全ての投稿"
|
||||||
followingList: "フォロー"
|
followingList: "フォロー"
|
||||||
|
|
|
@ -353,18 +353,41 @@ const age = $computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const timeForThem = $computed(() => {
|
const timeForThem = $computed(() => {
|
||||||
const tzInfo = cityTimezones.lookupViaCity(
|
const maybeCityNames = [
|
||||||
props.user.location!.replace(/\s.*/, "")
|
props.user.location!,
|
||||||
);
|
props.user
|
||||||
if (tzInfo.length == 0) return "";
|
.location!.replace(
|
||||||
const tz = tzInfo[0].timezone;
|
/[^A-Za-z0-9ÁĆÉǴÍḰĹḾŃÓṔŔŚÚÝŹáćéǵíḱĺḿńóṕŕśúýź\-\'\.\s].*/,
|
||||||
const theirTime = new Date().toLocaleString("en-US", {
|
""
|
||||||
timeZone: tz,
|
)
|
||||||
hour12: false,
|
.trim(),
|
||||||
});
|
props.user.location!.replace(
|
||||||
return ` (${theirTime.split(",")[1].trim().split(":")[0]}:${theirTime
|
/[^A-Za-zÁĆÉǴÍḰĹḾŃÓṔŔŚÚÝŹáćéǵíḱĺḿńóṕŕśúýź\-\'\.].*/,
|
||||||
.split(" ")[1]
|
""
|
||||||
.slice(-5, -3)})`;
|
),
|
||||||
|
props.user.location!.replace(
|
||||||
|
/[^A-Za-zÁĆÉǴÍḰĹḾŃÓṔŔŚÚÝŹáćéǵíḱĺḿńóṕŕśúýź].*/,
|
||||||
|
""
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const city of maybeCityNames) {
|
||||||
|
let tzInfo = cityTimezones.lookupViaCity(city);
|
||||||
|
if (tzInfo.length == 0) continue;
|
||||||
|
|
||||||
|
const tz = tzInfo[0].timezone;
|
||||||
|
if (!tz) continue;
|
||||||
|
|
||||||
|
const theirTime = new Date().toLocaleString("en-US", {
|
||||||
|
timeZone: tz,
|
||||||
|
hour12: false,
|
||||||
|
});
|
||||||
|
return ` (${theirTime.split(",")[1].trim().split(":")[0]}:${theirTime
|
||||||
|
.split(" ")[1]
|
||||||
|
.slice(-5, -3)})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
});
|
});
|
||||||
|
|
||||||
function menu(ev) {
|
function menu(ev) {
|
||||||
|
|
Loading…
Reference in New Issue