Skip to content

Commit

Permalink
Prepare for alpha (0.1.0) release
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
justingrant authored and ptomato committed Jul 8, 2021
1 parent 5ea7619 commit 5a55047
Show file tree
Hide file tree
Showing 9 changed files with 1,874 additions and 1,817 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
jobs:
test:
test-node16:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -15,3 +15,13 @@ jobs:
node-version: 16.x
- run: npm ci --no-optional
- run: npm test
test-node14:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci --no-optional
- run: npm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
dist/
.eslintcache
.vscode/
*.tgz
116 changes: 38 additions & 78 deletions lib/duration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,8 @@ export class Duration {
}
add(other, options = undefined) {
if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');
let {
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds
} = ES.ToLimitedTemporalDuration(other);
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
ES.ToLimitedTemporalDuration(other);
options = ES.GetOptionsObject(options);
const relativeTo = ES.ToRelativeTemporalObject(options);
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.AddDuration(
Expand Down Expand Up @@ -257,18 +247,8 @@ export class Duration {
}
subtract(other, options = undefined) {
if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver');
let {
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds
} = ES.ToLimitedTemporalDuration(other);
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
ES.ToLimitedTemporalDuration(other);
options = ES.GetOptionsObject(options);
const relativeTo = ES.ToRelativeTemporalObject(options);
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.AddDuration(
Expand Down Expand Up @@ -353,60 +333,40 @@ export class Duration {
largestUnit,
relativeTo
));
({
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds
} = ES.RoundDuration(
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds,
roundingIncrement,
smallestUnit,
roundingMode,
relativeTo
));
({
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds
} = ES.AdjustRoundedDurationDays(
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds,
roundingIncrement,
smallestUnit,
roundingMode,
relativeTo
));
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
ES.RoundDuration(
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds,
roundingIncrement,
smallestUnit,
roundingMode,
relativeTo
));
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
ES.AdjustRoundedDurationDays(
years,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds,
roundingIncrement,
smallestUnit,
roundingMode,
relativeTo
));
({ years, months, weeks, days } = ES.BalanceDurationRelative(years, months, weeks, days, largestUnit, relativeTo));
if (ES.IsTemporalZonedDateTime(relativeTo)) {
relativeTo = ES.MoveRelativeZonedDateTime(relativeTo, years, months, weeks, 0);
Expand Down

0 comments on commit 5a55047

Please sign in to comment.