angularjs错误的语言环境时间

时间:2016-11-28 14:51:12

标签: javascript angularjs bootstrap-datepicker

我正在努力解决一个完整的谜团。任何帮助将不胜感激。

我有两个使用相同基础的AngularJS应用程序(Angular 1.5.6)

我创建了一个嵌入DatePicker的指令。该指令在两个应用程序中使用。它使用户能够选择日期,直接输入。

在其中一个应用程序中,如果我执行console.log(myDate),我会得到:日期{Thu Apr 16 1964 02:00:00 GMT + 0100}

在另一个我得到:日期{Thu Apr 16 1964 02:00:00 GMT + 0200}

Aditionnaly这种行为可以在Firefox和Chrome中找到,所以我想我的第二个应用程序是在某个地方设置时区....

我根本无法理解为什么区域设置时间不同。它是否有可能来自第二个应用程序的一些秘密conf?

有关信息,我在两者中都使用了角度区域设置功能。<​​/ p>

<script src="vendors/bower_components/angular/angular-locale_fr-fr.js"></script>

非常感谢能够成功解决这个完整谜团的人!

问候。

编辑:这是我正在使用的指令:

.directive('fmkDateOrUpdate', ['$timeout', function($timeout) {
    return {
        restrict : 'E',
        scope : {
            titre : "@",
            enModification : "=",
            modele : "=",
            idValue  : "@?",
            classCss  : "@?",
            fullDate : "@?",
            textByDefault : "@?"
        },
        replace : false,
        transclude : true,
        template :  "<div class='ligneTitreValeur {{classCss}}'>" +
                    "   <div class='titre'>{{titre}} :</div>" +
                    "   <div class='valeur' ng-if='!fullDate' ng-hide='enModification'>{{ modele | date:'dd/MM/yyyy' }}</div>" +
                    "   <div class='valeur' ng-if='fullDate' ng-hide='enModification'>{{ modele  | date:'dd/MM/yyyy à HH:mm'}}</div>" +
                    "   <div class='valeurEnModification' ng-hide='!enModification'>" + 
                    "       <div class='date-picker input-group' ng-class=\"{ 'is-opened': opened == true }\" ng-controller='datePick'>" +
                    "           <div class='fg-line' ng-class=\"{ 'fg-toggled': opened == true }\">" +
                    "               <input placeholder='{{textByDefault}}' ng-click=\"open($event, 'opened')\" type='text' class='form-control check-valid-date' uib-datepicker-popup='{{format}}' show-weeks='false' ng-model='$parent.modele' is-open='opened' datepicker-options='dateOptions'  close-text='Close' id='{{idValue}}'/>" +
                    "           </div>" +
                    "       </div>" +
                    "   </div>" +
                    "</div>",
        link: function($scope, $element) {
            var element = $element[0].querySelector('input');
            element.addEventListener('click', function() {
                $timeout(function() {
                    element.focus();
                });
            });
        }
    };
}])

并且有这个指令的用法:

<fmk-date-or-update titre="Date de naissance"
    modele="personne.dateNaissance"
    en-modification="enModification()" class="">
</fmk-date-or-update>

编辑2: 这来自我的第二个申请。 myDate对象由ng-model对象链接......我仍然没有得到它

enter image description here

0 个答案:

没有答案
相关问题