fix time issue (#100)
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 22s

This commit is contained in:
Mylloon 2024-09-23 17:50:38 +02:00
parent 377ee13a13
commit 29c832367f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 4 additions and 7 deletions

View file

@ -131,9 +131,9 @@ export default async (message: Message, client: Client) => {
}
// Footer
let footer = `Posté le ${showDate(client.config.default_lang, loc, quoted_post!.createdAt)}`;
let footer = `Posté le ${showDate(loc, quoted_post!.createdAt)}`;
if (quoted_post?.editedAt) {
footer += ` et modifié le ${showDate(client.config.default_lang, loc, quoted_post.editedAt)}`;
footer += ` et modifié le ${showDate(loc, quoted_post.editedAt)}`;
}
let author = "Auteur";
@ -141,7 +141,6 @@ export default async (message: Message, client: Client) => {
author += " & Citateur";
} else {
footer += `\nCité par ${userWithNickname(message.member!) ?? "?"} le ${showDate(
client.config.default_lang,
loc,
message.createdAt,
)}`;

View file

@ -414,7 +414,6 @@ export const embedListReminders = async (
const expiration = `${loc.get("c_reminder8")} ${timeDeltaToString(remind.expiration_date)}`;
embed.addFields({
name: `#${remind.id}${loc.get("c_reminder9")} ${showDate(
local,
loc,
new Date(Number(remind.creation_date)),
)}\n${expiration}`,

View file

@ -5,9 +5,8 @@
* @param date Date
* @returns String
*/
export const showDate = (tz: string, locale: Map<string, unknown>, date: Date) => {
return date.toLocaleString(tz).replace(" ", ` ${locale.get("u_time_at")} `);
};
export const showDate = (locale: Map<string, unknown>, date: Date) =>
`${date.toDateString()} ${locale.get("u_time_at")} ${date.toTimeString().split(" ")[0]}`;
enum TimeSecond {
Year = 31536000,