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