Closed eassa closed 5 years ago
@eassa Looks like your date is in UTC instead of local time. Don't know for sure though http://momentjs.com/docs/#/parsing/utc/
this is my $watch , now the thing is that the dates are wrong only when i click on apply . the opts are fine and the first cal is good , but when i apply new custom date , only the endDate is a day more
$scope.$watch('userdate', function(newDate,oldDate) {
if (timer !== null) {
$timeout.cancel(timer);
}
timer = $timeout(function(){
if (!angular.isDefined($scope.userdate) || !angular.isDefined($scope.userdate.startDate)) {
$scope.userdate = {
startDate: moment().subtract(29, 'days'),
endDate: moment()
};
}
if(newDate != oldDate && !(angular.isNumber(oldDate)&& angular.isNumber(newDate)) ){
ufetch($scope.userid,'all');
}
}, 400);
}, false);
$scope.opts = {
ranges: {
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 15 Days': [moment().subtract(15, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()]
}
};
edit: formating
Please try new version 0.2.0
updating the Bootstrap Datepicker fixed the issue :) ,
but trying to update the angular-daterangepicker.js
it tells me "Don't make functions within a loop."
Line 151:-
for (eventType in _ref) {
callbackFunction = _ref[eventType];
_results.push(el.on(eventType, function() {
return $scope.$evalAsync(callbackFunction);
}));
Yes, but it's just a warning, isn't it?
yes , but it i am using playframework , such warnings does not let me compile my code , i will look into it if i can manage to skip this particular issue , but it could be awesome if you can do something about it
i am having this issue that when i use custom range and i click the end date , it shows for the user the right endDate , but in the javascript i am recieving an extra day :- see photos (though i am setting it to be the 23rd it returns the 24th) [start Date is good though]