Commit 2a307846 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: render correctly date time's value.

time's value should be calculate event if date only is set
because we may have case that date time field 's time and timezone are set  but it
only display date
parent 5a4f8069
......@@ -165,44 +165,44 @@
tmp_month = tmp.getUTCMonth() + 1;\n
tmp_year = tmp.getUTCFullYear();\n
\n
if (field_json.date_only === 0) {\n
tmp_hour = tmp.getUTCHours();\n
tmp_minute = tmp.getUTCMinutes();\n
tmp_hour = tmp.getUTCHours();\n
tmp_minute = tmp.getUTCMinutes();\n
\n
//timezone required\n
//convert time to GMT\n
timezone = parseInt(value.slice(-5), 10) / 100;\n
//timezone required\n
//convert time to GMT\n
timezone = parseInt(value.slice(-5), 10) / 100;\n
\n
if (field_json.timezone_style) {\n
select.selectedIndex = timezone + 12;\n
}\n
leapyear = (tmp_year % 4 === 0 && tmp_year % 100 !== 0) ? 1 : 0;\n
if (timezone !== 0) {\n
tmp_hour += timezone;\n
if (tmp_hour < 0) {\n
tmp_hour += 24;\n
tmp_date -= 1;\n
if (tmp_date === 0) {\n
tmp_month -= 1;\n
if (tmp_month === 0) {\n
tmp_month = 12;\n
tmp_year -= 1;\n
}\n
tmp_date = lastDateOfMonth[leapyear][tmp_month - 1];\n
if (field_json.timezone_style) {\n
select.selectedIndex = timezone + 12;\n
}\n
leapyear = (tmp_year % 4 === 0 && tmp_year % 100 !== 0) ? 1 : 0;\n
if (timezone !== 0) {\n
tmp_hour += timezone;\n
if (tmp_hour < 0) {\n
tmp_hour += 24;\n
tmp_date -= 1;\n
if (tmp_date === 0) {\n
tmp_month -= 1;\n
if (tmp_month === 0) {\n
tmp_month = 12;\n
tmp_year -= 1;\n
}\n
} else if (tmp_hour > 23) {\n
tmp_hour -= 24;\n
tmp_date += 1;\n
if (tmp_date > lastDateOfMonth[leapyear][tmp_month - 1]) {\n
tmp_date = 1;\n
tmp_month += 1;\n
if (tmp_month > 12) {\n
tmp_month = 1;\n
tmp_year += 1;\n
}\n
tmp_date = lastDateOfMonth[leapyear][tmp_month - 1];\n
}\n
} else if (tmp_hour > 23) {\n
tmp_hour -= 24;\n
tmp_date += 1;\n
if (tmp_date > lastDateOfMonth[leapyear][tmp_month - 1]) {\n
tmp_date = 1;\n
tmp_month += 1;\n
if (tmp_month > 12) {\n
tmp_month = 1;\n
tmp_year += 1;\n
}\n
}\n
}\n
}\n
if (field_json.date_only === 0) {\n
time = "T" + Math.floor(tmp_hour / 10) + tmp_hour % 10 + ":"\n
+ Math.floor(tmp_minute / 10) + (tmp_minute % 10) + ":00";\n
}\n
......@@ -502,7 +502,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -516,7 +516,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.415.21085.47820</string> </value>
<value> <string>943.49747.10334.23005</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -534,7 +534,7 @@
</tuple>
<state>
<tuple>
<float>1433234446.35</float>
<float>1434544511.89</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment