datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

Failed to execute 'getComputedStyle' on 'Window'

Open stibay opened this issue 9 years ago • 4 comments

Using datetimepicker in a modal popup window with angularjs and after I save a datetime and close the modal popup I am getting this error:

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.: at document path 'http://localhost:52970/Home/Index'.
  at anonymous('Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.', 'http://localhost:52970/scripts/plugins/jquery-datetimepicker/jquery.datetimepicker.full.js', '2582', '18', 'TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.')

I am wrapping the datetimpicker in an angular directive like this.

(function() {
    "use strict";

    angular
        .module("app.utils")
        .directive("datetimepicker",
        function () {
            return {
                restrict: "EA",
                require: "ngModel",
                scope: {
                    setMin: "=",
                    setMax: "=",
                    min: "=",
                    max: "=",
                    time: "="
                },
                link: function (scope, elem, attr) {
                    scope.options = {
                        dayOfWeekStart: 1,
                        format: "d.m.Y H:i",
                        formatTime: "H:i",
                        formatDate: "d.m.Y",
                        weeks: true
                    };

                    elem.on("focus", function (e) {
                        if (scope.min && scope.setMin) {
                            scope.options.minDate = scope.min;
                        }
                        if (scope.max && scope.setMax) {
                            scope.options.maxDate = scope.max;
                        }
                        if (scope.time === false) {
                            scope.options.format = "d.m.Y";
                            scope.options.timepicker = false;
                        }

                        $(elem).datetimepicker(scope.options);

                    }).datetimepicker(scope.options);
                }
            }
        });
})();

Any ideas?

stibay avatar Dec 14 '16 13:12 stibay

También sucede un error similar cuando recargo un div que contiene un datetimepicker: "Argument 1 of Window.getComputedStyle is not an object."

cacuestai avatar Dec 31 '16 16:12 cacuestai

This problem occurs to us as well. https://github.com/xdan/datetimepicker/blob/master/jquery.datetimepicker.js#L2004

It happens on old Chrome browsers for Desktop but also on new Chrome for Android as well.

mochja avatar Feb 27 '17 09:02 mochja

If merged should resolve issue in general. https://github.com/xdan/datetimepicker/pull/574

ed9 avatar May 07 '17 10:05 ed9

Do we have any update on the above issue?

ankitasuhaney avatar Feb 14 '20 17:02 ankitasuhaney