mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 05:34:09 +00:00
Feat/161 (#186)
* 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:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ontime",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"author": "Carlos Valente",
|
||||
"description": "Time keeping for live events",
|
||||
"repository": "https://github.com/cpvalente/ontime",
|
||||
|
||||
@@ -1049,7 +1049,6 @@ export class EventTimer extends Timer {
|
||||
this.runCycle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deleted an event from the list by its id
|
||||
* @param {string} eventId
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -13,6 +13,7 @@ export const dbModelv1 = {
|
||||
serverPort: 4001,
|
||||
lock: null,
|
||||
pinCode: null,
|
||||
timeFormat: '24',
|
||||
},
|
||||
aliases: [],
|
||||
userFields: {
|
||||
|
||||
@@ -51,4 +51,4 @@ describe('getPreviousPlayable()', () => {
|
||||
expect(id).toBe(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -184,6 +184,7 @@ describe('test json parser with valid def', () => {
|
||||
settings: {
|
||||
app: 'ontime',
|
||||
version: 1,
|
||||
timeFormat: '24',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -386,6 +387,7 @@ describe('test corrupt data', () => {
|
||||
version: 1,
|
||||
serverPort: 4001,
|
||||
lock: null,
|
||||
timeFormat: '24',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -408,6 +410,7 @@ describe('test corrupt data', () => {
|
||||
version: 1,
|
||||
serverPort: 4001,
|
||||
lock: null,
|
||||
timeFormat: '24',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -424,6 +427,7 @@ describe('test corrupt data', () => {
|
||||
version: 1,
|
||||
serverPort: 4001,
|
||||
lock: null,
|
||||
timeFormat: '24',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export const parseSettings_v1 = (data, enforce) => {
|
||||
const settings = {
|
||||
lock: s.lock || null,
|
||||
pinCode: s.pinCode || null,
|
||||
timeFormat: s.timeFormat || '24',
|
||||
};
|
||||
|
||||
// write to db
|
||||
|
||||
Reference in New Issue
Block a user