Improve forms, add helper buttons on add session form

This commit is contained in:
2023-02-21 23:49:57 +01:00
parent 366c25a1ff
commit fa4f1c4810
9 changed files with 97 additions and 5 deletions

9
games/static/js/utils.js Normal file
View File

@ -0,0 +1,9 @@
/**
* @description Formats Date to a UTC string accepted by the datetime-local input field.
* @param {Date} date
* @returns {string}
*/
export function toISOUTCString(date) {
let month = (date.getMonth() + 1).toString().padStart(2, 0);
return `${date.getFullYear()}-${month}-${date.getDate()}T${date.getHours()}:${date.getMinutes()}`;
}