]> git.ipfire.org Git - thirdparty/moment.git/commit
[feature] Add support for creating duration from numeric string
authorZach Gawlik <ZachGawlik@users.noreply.github.com>
Sat, 3 Feb 2018 22:31:19 +0000 (17:31 -0500)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 25 Apr 2020 22:39:34 +0000 (01:39 +0300)
commita021ade5d74c282de0743a78deec7b866c185e36
tree2d26a5e3876004ad48b5ba0841afcd72a36b95ce
parentebfd8dae146cd8ec1cb4943cd663eda75a720b82
[feature] Add support for creating duration from numeric string

Similar to other moment methods, a string representing a number is
(unfortunately) supported. This change adds support in duration
constructor.

    moment.duration('5')            # 5 milliseconds
    moment.duration('5', 'seconds') # 5 seconds
src/lib/duration/create.js
src/lib/moment/add-subtract.js
src/test/moment/duration.js