I
I
IvanOne2015-07-05 09:12:21
JavaScript
IvanOne, 2015-07-05 09:12:21

How to solve problem with increasing hours in datetimepicker?

Good afternoon! I ran into an unknown error, the angular project picked up this plugin eonasdan.github.io/bootstrap-datetimepicker , wrote the directive:

app.directive('datetimepicker', function() {
   return {
        require: 'ngModel',
        link: function (scope, element, attrs, ngModelCtrl) {
        $(function() {
            element.datetimepicker({
                format: 'DD.MM.YYYY HH:mm',
                locale: 'ru'
            })
                .on('dp.change', function(value){
                    ngModelCtrl.$setViewValue(value['date']);
                    scope.$apply();
                    if(value['date']){
                        element.removeClass('empty');
                    }
                    else{
                        element.addClass('empty');
                    }
                });
     });
  }
 }
});

But the following bug occurs when I select the time, it returns the date 3 hours less in the script, most likely a bug in moment js, but I can’t figure out how to solve it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question