Skip to content

Commit 1b59a9a

Browse files
committed
Merge branch 'feat/duration-calculator' into chore/all-my-stuffs
# Conflicts: # package.json # pnpm-lock.yaml # src/tools/index.ts
2 parents cf56644 + dec2e31 commit 1b59a9a

17 files changed

+2267
-4
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@tiptap/starter-kit": "2.1.6",
4949
"@tiptap/vue-3": "2.0.3",
5050
"@types/figlet": "^1.5.8",
51+
"@types/luxon": "^3.4.2",
5152
"@types/markdown-it": "^13.0.7",
5253
"@vicons/material": "^0.12.0",
5354
"@vicons/tabler": "^0.12.0",
@@ -62,6 +63,7 @@
6263
"composerize-ts": "^0.6.2",
6364
"countries-db": "^1.2.0",
6465
"composerize": "^1.6.12",
66+
"countries-and-timezones": "^3.7.2",
6567
"country-code-lookup": "^0.1.0",
6668
"crc": "^4.3.2",
6769
"cron-validator": "^1.3.1",
@@ -76,6 +78,9 @@
7678
"decomposerize": "^1.4.1",
7779
"dompurify": "^3.0.6",
7880
"email-bounce-parser-browser": "^1.1",
81+
"date-holidays": "^3.23.12",
82+
"dompurify": "^3.0.6",
83+
"duration-fns": "^3.0.2",
7984
"email-normalizer": "^1.0.0",
8085
"emojilib": "^3.0.10",
8186
"figlet": "^1.7.0",
@@ -91,6 +96,7 @@
9196
"jwt-decode": "^3.1.2",
9297
"libphonenumber-js": "^1.10.28",
9398
"lodash": "^4.17.21",
99+
"luxon": "^3.5.0",
94100
"markdown-it": "^14.0.0",
95101
"marked": "^10.0.0",
96102
"mathjs": "^11.9.1",
@@ -101,9 +107,11 @@
101107
"node-forge": "^1.3.1",
102108
"openpgp": "^5.11.1",
103109
"oui-data": "^1.0.10",
110+
"parse-duration": "^1.1.0",
104111
"pdf-signature-reader": "^1.4.2",
105112
"pinia": "^2.0.34",
106113
"plausible-tracker": "^0.3.8",
114+
"pretty-ms": "^9.1.0",
107115
"qrcode": "^1.5.1",
108116
"randexp": "^0.5.3",
109117
"regex": "^4.3.3",

pnpm-lock.yaml

Lines changed: 129 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { describe, expect, it } from 'vitest';
2+
import { addToDate } from './date-duration-calculator.service';
3+
4+
describe('date-duration-calculator', () => {
5+
describe('addToDate', () => {
6+
it('compute right values', () => {
7+
expect(addToDate(new Date('2024-08-15T07:21:46Z'), '+1d 1m 20s')).to.deep.eq(
8+
{
9+
date: new Date('2024-08-16T07:23:06.000Z'),
10+
durationPretty: '1d 1m 20s',
11+
durationSeconds: 86480,
12+
errors: [],
13+
},
14+
);
15+
});
16+
});
17+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { computeDuration } from '../duration-calculator/duration-calculator.service';
2+
3+
export function addToDate(date: Date, durations: string) {
4+
const { total, errors } = computeDuration(durations);
5+
6+
return {
7+
errors,
8+
date: new Date(date.getTime() + total.milliseconds),
9+
durationSeconds: total.seconds,
10+
durationPretty: total.prettified,
11+
};
12+
}

0 commit comments

Comments
 (0)