Primary
moment().add() ⚬|Documentation|1st|20251021000632-00-⌔
Add 1.0.0+
moment().add(Number, String); moment().add(Duration); moment().add(Object);Mutates the original moment by adding time.
This is a pretty robust function for adding time to an existing moment. To add time, pass the key of what time you want to add, and the amount you want to add.
moment().add(7, 'days');There are some shorthand keys as well if you’re into that whole brevity thing.
moment().add(7, 'd');If you want to add multiple different keys at the same time, you can pass them in as an object literal.
moment().add(7, 'days').add(1, 'months'); // with chaining moment().add({days:7,months:1}); // with object literalThere are no upper limits for the amounts, so you can overload any of the parameters.
moment().add(1000000, 'milliseconds'); // a million milliseconds moment().add(360, 'days'); // 360 daysPrinted 2026-06-28.
(echo:: @ ᯤ)
Link to original
Secondary
• • •