* feat(time): add optional time format
* feat(time): show 12 hour time in stage timer
* feat(time): override locally
* feat(time): show timer in selected format
* feat(time): show 12 hour time in table header
* refactor: extract time formatting into utility
* refactor: migrate datetime library
* refactor(formatTime): centralise time formatting for viewers
* feature(12hour): version bump
This commit is contained in:
Carlos Valente
2022-08-30 19:04:02 +02:00
committed by GitHub
parent a8ce6f3fc1
commit 0651777055
37 changed files with 459 additions and 378 deletions
@@ -201,12 +201,14 @@ export const getSettings = async (req, res) => {
const version = data.settings.version;
const serverPort = data.settings.serverPort;
const pinCode = data.settings.pinCode;
const timeFormat = data.settings.timeFormat;
// send object with network information
res.status(200).send({
version,
serverPort,
pinCode,
timeFormat,
});
};
@@ -226,9 +228,18 @@ export const postSettings = async (req, res) => {
pin = req.body?.pinCode;
}
}
let timeFormat = data.settings.timeFormat;
if (typeof req.body?.timeFormat === 'string') {
if (req.body?.timeFormat === '12' || req.body?.timeFormat === '24') {
timeFormat = req.body.timeFormat;
}
}
data.settings = {
...data.settings,
pinCode: pin,
timeFormat: timeFormat,
};
await db.write();
res.sendStatus(200);