diff app/model/Messprogramm.js @ 1191:62f374ea7ab7

Use UTC date in messprogramm to generate probe objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 07 Sep 2016 17:16:26 +0200
parents 61cc583c3649
children 0a7f0a09151c
line wrap: on
line diff
--- a/app/model/Messprogramm.js	Wed Aug 31 15:56:07 2016 +0200
+++ b/app/model/Messprogramm.js	Wed Sep 07 17:16:26 2016 +0200
@@ -84,7 +84,12 @@
         },
         serialize: function(value) {
             if (value instanceof Date && !isNaN(value.valueOf())) {
-                return Ext.Date.getDayOfYear(value);
+                var dayOfYear = Ext.Date.getDayOfYear(value);
+                var offset = value.getTimezoneOffset();
+                if (offset == 0) {
+                    return dayOfYear;
+                }
+                return offset > 0 ? dayOfYear - 1 : dayOfYear + 1;
             }
         }
     }, {
@@ -112,7 +117,12 @@
         },
         serialize: function(value) {
             if (value instanceof Date && !isNaN(value.valueOf())) {
-                return Ext.Date.getDayOfYear(value);
+                var dayOfYear = Ext.Date.getDayOfYear(value);
+                var offset = value.getTimezoneOffset();
+                if (offset == 0) {
+                    return dayOfYear;
+                }
+                return offset > 0 ? dayOfYear - 1 : dayOfYear + 1;
             }
         }
     }, {

http://lada.wald.intevation.org