Skip to content

Commit

Permalink
Merge pull request #387 from InExtremaRes/clock-offset-types
Browse files Browse the repository at this point in the history
Add missing types for Clock.offset()
  • Loading branch information
pithu committed Mar 6, 2020
2 parents 8efd162 + 2d95c8c commit 5f7ae19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/dist/js-joda.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export abstract class Temporal extends TemporalAccessor {

export abstract class Clock {
static fixed(fixedInstant: Instant, zoneId: ZoneId): Clock;
static offset(baseClock: Clock, offsetDuration: Duration): Clock;
static system(zone: ZoneId): Clock;
static systemDefaultZone(): Clock;
static systemUTC(): Clock;
Expand Down
5 changes: 4 additions & 1 deletion packages/core/test/typescript_definitions/js-joda-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,13 @@ function test_Month() {

function test_Clock() {
const clock = Clock.systemUTC();
const clock2 = Clock.fixed(Instant.now(), ZoneId.UTC);
const fixed = Clock.fixed(Instant.now(), ZoneId.UTC);
const offset = Clock.offset(clock, Duration.ofHours(1));

expectType<ZoneId>(clock.zone());
expectType<Clock>(clock.withZone(ZoneId.UTC));
expectType<Clock>(fixed);
expectType<Clock>(offset);
}

function test_Temporal() {
Expand Down

0 comments on commit 5f7ae19

Please sign in to comment.