Compare commits
2 commits
1bc77efb2a
...
8f33dd8ea4
Author | SHA1 | Date | |
---|---|---|---|
8f33dd8ea4 | |||
4dad223f1b |
2 changed files with 7 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
import { showDate } from "../../utils/time";
|
||||
import { showDate, strToSeconds } from "../../utils/time";
|
||||
|
||||
describe("Date with correct timezone", () => {
|
||||
const map = new Map([["u_time_at", "@"]]);
|
||||
|
@ -31,20 +31,18 @@ describe("Date with correct timezone", () => {
|
|||
}
|
||||
});
|
||||
|
||||
/* describe("String time to seconds", () => {
|
||||
describe("String time to seconds", () => {
|
||||
{
|
||||
const name = "10m30";
|
||||
test(name, () => {
|
||||
expect(strToSeconds(name)).toBe(630);
|
||||
});
|
||||
}
|
||||
}); */
|
||||
|
||||
/* describe("Time delta", () => {
|
||||
{
|
||||
const name = 1312;
|
||||
test(name.toString(), () => {
|
||||
expect(timeDeltaToString(name)).toBe("0 secs");
|
||||
// todo: see https://git.mylloon.fr/ConfrerieDuKassoulait/Botanique/issues/183
|
||||
const name = "12h30";
|
||||
test(name, () => {
|
||||
/* expect(strToSeconds(name)).toBe(45000); */
|
||||
});
|
||||
}
|
||||
}); */
|
||||
});
|
||||
|
|
|
@ -61,8 +61,6 @@ export const strToSeconds = (time: string) => {
|
|||
|
||||
let res = 0;
|
||||
data.forEach((match) => {
|
||||
console.log(match.groups);
|
||||
|
||||
Object.entries(match.groups!).forEach(([key, value]) => {
|
||||
if (value) {
|
||||
res += +value * TimeSecond[key as keyof typeof TimeSecond];
|
||||
|
|
Loading…
Reference in a new issue