comparison app/model/Messprogramm.js @ 1199:0a7f0a09151c

Replace date-time picker with appropriate widget to select day of year. Validity period is not specific for a year. The calender widget was not appropriate here.
author Tom Gottfried <tom@intevation.de>
date Fri, 23 Sep 2016 16:49:26 +0200
parents 62f374ea7ab7
children 05c8bd380fd5
comparison
equal deleted inserted replaced
1198:3b6f40541ac6 1199:0a7f0a09151c
59 }, { 59 }, {
60 name: 'teilintervallBis' 60 name: 'teilintervallBis'
61 }, { 61 }, {
62 name: 'intervallOffset' 62 name: 'intervallOffset'
63 }, { 63 }, {
64 name: 'gueltigVon', 64 name: 'gueltigVon'
65 type: 'date',
66 convert: function(v) {
67 var firstofyeartimestamp = new Date(
68 Date.UTC(
69 new Date().getFullYear(),0,1))
70 .valueOf();
71 var dayToMilli = 86400000;
72
73 if (!v) {
74 return v;
75 }
76 //check if v might be a date
77 // unless we go back in time this will work
78 if (v < 1000) {
79 v = v * dayToMilli;
80 v = v + firstofyeartimestamp;
81 v = new Date(v);
82 }
83 return v;
84 },
85 serialize: function(value) {
86 if (value instanceof Date && !isNaN(value.valueOf())) {
87 var dayOfYear = Ext.Date.getDayOfYear(value);
88 var offset = value.getTimezoneOffset();
89 if (offset == 0) {
90 return dayOfYear;
91 }
92 return offset > 0 ? dayOfYear - 1 : dayOfYear + 1;
93 }
94 }
95 }, { 65 }, {
96 name: 'gueltigBis', 66 name: 'gueltigBis'
97 type: 'date',
98 convert: function(v) {
99 var firstofyeartimestamp = new Date(
100 Date.UTC(
101 new Date().getFullYear(),0,1))
102 .valueOf();
103 var dayToMilli = 86400000;
104
105 if (!v) {
106 return v;
107 }
108
109 //check if v might be a date
110 // unless we go back in time this will work
111 if (v < 1000) {
112 v = v * dayToMilli;
113 v = v + firstofyeartimestamp;
114 v = new Date(v);
115 }
116 return v;
117 },
118 serialize: function(value) {
119 if (value instanceof Date && !isNaN(value.valueOf())) {
120 var dayOfYear = Ext.Date.getDayOfYear(value);
121 var offset = value.getTimezoneOffset();
122 if (offset == 0) {
123 return dayOfYear;
124 }
125 return offset > 0 ? dayOfYear - 1 : dayOfYear + 1;
126 }
127 }
128 }, { 67 }, {
129 name: 'probeNehmerId' 68 name: 'probeNehmerId'
130 }, { 69 }, {
131 name: 'probeKommentar' 70 name: 'probeKommentar'
132 }, { 71 }, {

http://lada.wald.intevation.org