如何根据javascript中的间隔生成开始时间和结束时间?

时间:2015-10-29 07:08:33

标签: javascript angularjs

我有以下代码。

$scope.Teeslots = function () {
            debugger;
            $scope.TimeValues = [];
            $scope.StartTime = $scope.TeeSheetModel.StartTime;//1
            $scope.EndTime = $scope.TeeSheetModel.EndTime; //5
            $scope.Interval = $scope.TeeSheetModel.Interval;//15
            var count = 0;

            for (var i = $scope.StartTime; i < $scope.EndTime; i++) {

                var OFFSlotStartTime = i;
                var OFFSlotEndTime = i + ':' + $scope.Interval
                var OFFSlotTime = OFFSlotStartTime + '-' + OFFSlotEndTime;

                var j = OFFSlotTime.substring(2, OFFSlotTime.length);

                $scope.TimeValues.push(OFFSlotTime);
            }


        }

预期产出: -

0-0:15
0:15-0:30
0:30-0:45
0:45:1
1:15-1:30
---
4:45-5

请帮我怎么做?

0 个答案:

没有答案