Skip to content

Commit

Permalink
Merge e5f13e1 into e70bee7
Browse files Browse the repository at this point in the history
  • Loading branch information
pvmeijel authored Feb 4, 2023
2 parents e70bee7 + e5f13e1 commit f49c37a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugin/duration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ class Duration {
.fromNow(!withSuffix)
}

valueOf() {
return this.asMilliseconds()
}

milliseconds() { return this.get('milliseconds') }
asMilliseconds() { return this.as('milliseconds') }
seconds() { return this.get('seconds') }
Expand Down
3 changes: 3 additions & 0 deletions test/plugin/duration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ describe('Creating', () => {
ms: -1
}).toISOString()).toBe('-PT0.001S')
})
it('convert to milliseconds', () => {
expect(+dayjs.duration(100)).toBe(100)
})
})

describe('Parse ISO string', () => {
Expand Down

0 comments on commit f49c37a

Please sign in to comment.