changed from ISO to LocaleDateString, Made Regex work with Any Prefix

This commit is contained in:
2026-07-04 04:00:12 +02:00
parent 6b2fab8b95
commit 4727434362
2 changed files with 37 additions and 40 deletions
+17 -22
View File
@@ -9,16 +9,6 @@ const {
const { mClient } = require('../../..');
require('dotenv').config()
function formatGermanDate(dateStr) {
const date = new Date(dateStr);
return new Intl.DateTimeFormat("de-DE", {
year: "numeric",
month: "2-digit",
day: "2-digit"
}).format(date);
}
module.exports = {
data: new SlashCommandBuilder()
.setName('ezd')
@@ -28,7 +18,9 @@ module.exports = {
const db = mClient.db(process.env.M_DB); // adjust if needed
const coll = db.collection('items_daily_numbers');
const today = new Date().toISOString().slice(0, 10);
const today = new Date().toLocaleDateString("en-CA", {
timeZone: "Europe/Berlin"
});
let currentDate = today;
@@ -42,17 +34,21 @@ module.exports = {
return `${emoji} **${label}:** ${v ? `<@${v.userId}>` : "—"}`;
};
const germanDate = new Date(`${date}T00:00:00`).toLocaleDateString("de-DE", {
timeZone: "Europe/Berlin",
day: "2-digit",
month: "2-digit",
year: "numeric"
});
return new EmbedBuilder()
.setTitle(`📊 EZD Übersicht ${formatGermanDate(date)}`)
.setTitle(`📊 EZD Übersicht ${germanDate}`)
.setColor(0x2b2d31)
.setDescription(
[
line("🥇", "Erster", "Erster"),
line("🥈", "Zweiter", "Zweiter"),
line("🥉", "Dritter", "Dritter")
].join("\n")
)
.setFooter({ text: `Datum: ${date}` });
.setDescription([
line("🥇", "Ersti", "Ersti"),
line("🥈", "Zweiti", "Zweiti"),
line("🥉", "Dritti", "Dritti")
].join("\n"));
};
const buildButtons = (date) => {
@@ -72,8 +68,7 @@ module.exports = {
const msg = await interaction.reply({
embeds: [buildEmbed(doc, currentDate)],
components: [buildButtons(currentDate)],
flags: MessageFlags.Ephemeral
components: [buildButtons(currentDate)]
});
const collector = msg.createMessageComponentCollector({