Skip to content

Commit 5a55047

Browse files
justingrantptomato
authored andcommitted
Prepare for alpha (0.1.0) release
* update version to 0.1.0 * copy recent code & test changes from original repo * switch CI tests to run Node 14 and 16 (remove 15) * run prettier --fix * update dependencies * update .gitignore
1 parent 5ea7619 commit 5a55047

File tree

9 files changed

+1874
-1817
lines changed

9 files changed

+1874
-1817
lines changed

Diff for: .github/workflows/test.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
jobs:
8-
test:
8+
test-node16:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
@@ -15,3 +15,13 @@ jobs:
1515
node-version: 16.x
1616
- run: npm ci --no-optional
1717
- run: npm test
18+
test-node14:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: use node.js v14.x
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 14.x
26+
- run: npm ci --no-optional
27+
- run: npm test

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules/
22
dist/
33
.eslintcache
4+
.vscode/
5+
*.tgz

Diff for: lib/duration.mjs

+38-78
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,8 @@ export class Duration {
216216
}
217217
add(other, options = undefined) {
218218
if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');
219-
let {
220-
years,
221-
months,
222-
weeks,
223-
days,
224-
hours,
225-
minutes,
226-
seconds,
227-
milliseconds,
228-
microseconds,
229-
nanoseconds
230-
} = ES.ToLimitedTemporalDuration(other);
219+
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
220+
ES.ToLimitedTemporalDuration(other);
231221
options = ES.GetOptionsObject(options);
232222
const relativeTo = ES.ToRelativeTemporalObject(options);
233223
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.AddDuration(
@@ -257,18 +247,8 @@ export class Duration {
257247
}
258248
subtract(other, options = undefined) {
259249
if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');
260-
let {
261-
years,
262-
months,
263-
weeks,
264-
days,
265-
hours,
266-
minutes,
267-
seconds,
268-
milliseconds,
269-
microseconds,
270-
nanoseconds
271-
} = ES.ToLimitedTemporalDuration(other);
250+
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
251+
ES.ToLimitedTemporalDuration(other);
272252
options = ES.GetOptionsObject(options);
273253
const relativeTo = ES.ToRelativeTemporalObject(options);
274254
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.AddDuration(
@@ -353,60 +333,40 @@ export class Duration {
353333
largestUnit,
354334
relativeTo
355335
));
356-
({
357-
years,
358-
months,
359-
weeks,
360-
days,
361-
hours,
362-
minutes,
363-
seconds,
364-
milliseconds,
365-
microseconds,
366-
nanoseconds
367-
} = ES.RoundDuration(
368-
years,
369-
months,
370-
weeks,
371-
days,
372-
hours,
373-
minutes,
374-
seconds,
375-
milliseconds,
376-
microseconds,
377-
nanoseconds,
378-
roundingIncrement,
379-
smallestUnit,
380-
roundingMode,
381-
relativeTo
382-
));
383-
({
384-
years,
385-
months,
386-
weeks,
387-
days,
388-
hours,
389-
minutes,
390-
seconds,
391-
milliseconds,
392-
microseconds,
393-
nanoseconds
394-
} = ES.AdjustRoundedDurationDays(
395-
years,
396-
months,
397-
weeks,
398-
days,
399-
hours,
400-
minutes,
401-
seconds,
402-
milliseconds,
403-
microseconds,
404-
nanoseconds,
405-
roundingIncrement,
406-
smallestUnit,
407-
roundingMode,
408-
relativeTo
409-
));
336+
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
337+
ES.RoundDuration(
338+
years,
339+
months,
340+
weeks,
341+
days,
342+
hours,
343+
minutes,
344+
seconds,
345+
milliseconds,
346+
microseconds,
347+
nanoseconds,
348+
roundingIncrement,
349+
smallestUnit,
350+
roundingMode,
351+
relativeTo
352+
));
353+
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
354+
ES.AdjustRoundedDurationDays(
355+
years,
356+
months,
357+
weeks,
358+
days,
359+
hours,
360+
minutes,
361+
seconds,
362+
milliseconds,
363+
microseconds,
364+
nanoseconds,
365+
roundingIncrement,
366+
smallestUnit,
367+
roundingMode,
368+
relativeTo
369+
));
410370
({ years, months, weeks, days } = ES.BalanceDurationRelative(years, months, weeks, days, largestUnit, relativeTo));
411371
if (ES.IsTemporalZonedDateTime(relativeTo)) {
412372
relativeTo = ES.MoveRelativeZonedDateTime(relativeTo, years, months, weeks, 0);

0 commit comments

Comments
 (0)