moment js取当前时间并"小时数"+1,分钟秒数设置为0

遇到一个需求,在angular xedittable中动态建立时间,因此想取到当前时间完整的数字,并把开始时间加1作为结束时间:ui

- moment(new Date()).set({'minute': 00, 'second': 00}).toJSON(),
- moment(new Date()).add(1, 'H').set({'minute': 00, 'second': 00}).toJSON(),

###完整的动态增长时间行:code

$scope.addTime = function (data, start, end) {
            $log.info($rootScope.inctimeresutc);
            var uicon = 1;
            $rootScope.inserted = {
                id: $rootScope.inctimeresutc.length + 1,
                uid: current_user_id,
                uicon: uicon,
                start: moment(new Date()).set({'minute': 00, 'second': 00}).toJSON(),
                end: moment(new Date()).add(1, 'H').set({'minute': 00, 'second': 00}).toJSON(),
                mb: '0'
            };
            $rootScope.inctimeresutc.push($rootScope.inserted);
        };
相关文章
相关标签/搜索