mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 13:44:12 +00:00
Improve spreadsheet import flow (#839)
* feat: add dropdown to worksheet selection * feat: move revoke to separate button * refactor: extract excel flow to separate controller and service * chore: show spinner when uploading sheet and disable the other option * chore: don't show "success" when canceling the import * chore: export boolean types properly to sheets
This commit is contained in:
committed by
GitHub
parent
f4692db021
commit
f5e9a2549e
@@ -24,3 +24,12 @@ describe('test isTimeString() function handle different separators', () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('test isTimeString() function handle AM/PM', () => {
|
||||
const ts = ['2:10AM', '2:10PM', '2:10'];
|
||||
for (const s of ts) {
|
||||
it(`it handles ${s}`, () => {
|
||||
expect(isTimeString(s)).toBe(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,16 +4,6 @@
|
||||
* @returns {boolean} string represents time
|
||||
*/
|
||||
export const isTimeString = (text: string): boolean => {
|
||||
// ^ # Start of string
|
||||
// (?: # Try to match...
|
||||
// (?: # Try to match...
|
||||
// ([01]?\d|2[0-3]): # HH:
|
||||
// )? # (optionally).
|
||||
// ([0-5]?\d): # MM: (required)
|
||||
// )? # (entire group optional, so either HH:MM:, MM: or nothing)
|
||||
// ([0-5]?\d) # SS (required)
|
||||
// $ # End of string
|
||||
|
||||
const regex = /^(?:(?:([01]?\d|2[0-3])[:,.])?([0-5]?\d)[:,.])?([0-5]?\d)$/;
|
||||
const regex = /^(?:(?:([01]?\d|2[0-3])[:,.])?([0-5]?\d)[:,.])?([0-5]?\d)?(\s)?([APap][Mm])?$/;
|
||||
return regex.test(text);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user