mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-09 04:36:02 -05:00
New event dates fix able to submit without one
This commit is contained in:
@@ -34,7 +34,19 @@ export function weekNumberToDate({
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Returns date as a string with the format YYYY-MM-DDThh:mm */
|
||||
/** Returns date as a string with the format YYYY-MM-DDThh:mm in user's time zone */
|
||||
export function dateToYearMonthDayHourMinuteString(date: Date) {
|
||||
return date.toISOString().slice(0, 16);
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
const hour = date.getHours();
|
||||
const minute = date.getMinutes();
|
||||
|
||||
return `${year}-${prefixZero(month)}-${prefixZero(day)}T${prefixZero(
|
||||
hour
|
||||
)}:${prefixZero(minute)}`;
|
||||
}
|
||||
|
||||
function prefixZero(number: number) {
|
||||
return number < 10 ? `0${number}` : number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user