add some hours to birthdate to remove confusion with timezones

This commit is contained in:
Jonny_Bro (Nikita) 2024-05-11 15:16:53 +05:00
parent 66f7a45f60
commit 937eabf1bd
Signed by: jonny_bro
GPG key ID: 3F1ECC04147E9BD8

View file

@ -75,8 +75,11 @@ class Birthdate extends BaseCommand {
day = interaction.options.getInteger("day"), day = interaction.options.getInteger("day"),
month = interaction.options.getInteger("month"), month = interaction.options.getInteger("month"),
year = interaction.options.getInteger("year"), year = interaction.options.getInteger("year"),
date = new Date(year, month - 1, day), date = new Date(year, month - 1, day);
d = Math.floor(date.getTime() / 1000);
date.setHours(12);
const d = Math.floor(date.getTime() / 1000);
if (!(day == date.getDate() && month - 1 == date.getMonth() && year == date.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE"); if (!(day == date.getDate() && month - 1 == date.getMonth() && year == date.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE");
if (date.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH"); if (date.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");