Trying to add to times but deprecation warnings as result:
var one = new moment('00:00:01.000', 'HH:mm:ss.SSS'); var two = new moment('00:00:03.002', 'HH:mm:ss.SSS'); var tot = one.add(two); console.log(tot);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js"></script>
Before version 2.8.0, the moment#add(String, Number) syntax was also supported. It has been deprecated in favor of moment#add(Number, String).
moment().add('seconds', 1); // Deprecated in 2.8.0
moment().add(1, 'seconds');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.