We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e70bee7 commit 9b4fcfdCopy full SHA for 9b4fcfd
src/plugin/duration/index.js
@@ -235,6 +235,10 @@ class Duration {
235
.fromNow(!withSuffix)
236
}
237
238
+ valueOf() {
239
+ return this.asMilliseconds()
240
+ }
241
+
242
milliseconds() { return this.get('milliseconds') }
243
asMilliseconds() { return this.as('milliseconds') }
244
seconds() { return this.get('seconds') }
test/plugin/duration.test.js
@@ -67,6 +67,9 @@ describe('Creating', () => {
67
ms: -1
68
}).toISOString()).toBe('-PT0.001S')
69
})
70
+ it('convert to milliseconds', () => {
71
+ expect(+dayjs.duration(100)).toBe(100)
72
+ })
73
74
75
describe('Parse ISO string', () => {
0 commit comments