improvement: hide seconds (#675)

* feat: optional timer seconds
This commit is contained in:
Carlos Valente
2023-12-31 12:13:05 +01:00
committed by GitHub
parent a5d8b91f34
commit 9a4d659b04
29 changed files with 223 additions and 125 deletions
@@ -36,4 +36,14 @@ describe('formatTime()', () => {
const time = formatTime(ms, options, () => '12');
expect(time).toStrictEqual('01:00 PM');
});
it('handles negative times', () => {
const ms = 1 * 60 * 60 * 1000;
const options = {
showSeconds: false,
format: 'hh:mm:ss',
};
const time = formatTime(ms * -1, options, () => '24');
expect(time).toStrictEqual('-01:00');
});
});