Make 32 Hrs range in RZSlider in Angular Js?

Viewed 772

I have to implement one RZSlider with 10 minutes interval with 32Hrs. I am using date picker also. So I set this date picker and time slider into one html page. If when I land on this page then It should be select by default today date with 8 Hrs window, Mean -4Hrs and +4Hrs with current date. For Example: If I land on this page 23 july at 23:00, Then range should be 19:00 to 3:00. But In this case 3:00 comes into 24 July. I want to make this slider like date picker with time.

starting from 8:10,8:20,8:30,8:40,8:50,9:10.....12:10,12:20.......23:10,23:20,23:30,23:40,23:50,00:00,00.10,00:20,00:30,00:40,00:50,1:00.......4:00 End To.

I already implement some logic for 32Hrs range but this is failing in some cases then slider will break and compatible issue will comes. I am not able show my code because code is dependent on other code.

var app = angular.module('rzSliderDemo', ['rzModule', 'ui.bootstrap']);

app.controller('MainCtrl', function($scope, $rootScope, $timeout) {
  var arr = getRange().map(n => {
    return {
      value: n,
      legend: n
    };
  });
  
  $scope.slider = {
    minValue: '10.50',
    maxValue: '14.20',
    options: {
      showTicks: true,
      stepsArray: arr,
      draggableRange: true,
    }
  };
});

function getRange() {
  var arr = [];
  var d = new Date(2017, 1, 1);
  for (var i = 0; i < (6 * 28); i++) {
    d.setMinutes(d.getMinutes() + 10);
    arr.push(leadZero(d.getHours()) + '.' + leadZero(d.getMinutes()));
  }
  return arr;
}

function leadZero(time) {
  return time < 10 ? '0' + time : time;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://rawgit.com/rzajac/angularjs-slider/master/dist/rzslider.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.js"></script>
<script src="https://rawgit.com/rzajac/angularjs-slider/master/dist/rzslider.js"></script>
<div ng-app="rzSliderDemo">
  <div ng-controller="MainCtrl" class="wrapper">
    <header>
      <h1>AngularJS Touch Slider</h1>

    </header>
    <article>
      <h2>Simple slider</h2>
      Model:
      <input type="text" ng-model="slider.minValue" />
      <input type="text" ng-model="slider.maxValue" />
      <br/>
      <rzslider rz-slider-model="slider.minValue" rz-slider-high="slider.maxValue" rz-slider-options="slider.options"></rzslider>
    </article>
  </div>
</div>
In this example It is going to next day 4 hrs but not going to previous date Hrs.

1 Answers
Related