Skip to content

Instantly share code, notes, and snippets.

@Hirurg103
Created October 28, 2018 12:45
Show Gist options
  • Save Hirurg103/f0723f6c81842d01848483c1d4fe2191 to your computer and use it in GitHub Desktop.
Save Hirurg103/f0723f6c81842d01848483c1d4fe2191 to your computer and use it in GitHub Desktop.
Bug with setValue: hours is 1hr less than selected
<!doctype html>
<html>
<head>
<script src="https://rawgit.com/jquery/jquery/1.12.4/dist/jquery.min.js"></script>
<script src="https://rawgit.com/moment/moment/develop/min/moment-with-locales.min.js"></script>
<script src="https://rawgit.com/longbill/jquery-date-range-picker/master/dist/jquery.daterangepicker.min.js"></script>
<link href="https://rawgit.com/longbill/jquery-date-range-picker/master/dist/daterangepicker.min.css" rel="stylesheet"/>
</head>
<body>
<input type="text" id="from"/>
<input type="text" id="to"/>
<a id="datepicker">
select dates
</a>
<script>
$('#datepicker').dateRangePicker({
separator: ' to ',
time: { enabled: true },
format: 'DD-MM-YYYY HH:mm',
showShortcuts: true,
setValue: function(s, s1, s2) {
console.log(s)
console.log(s1)
console.log(s2)
$(this).val(s)
$("#from").val(s1)
$("#to").val(s2)
},
shortcuts: {
'prev-days': null,
'next-days': null,
prev: null,
next: null
},
startOfWeek: 'monday'
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment