Commit f634ac3e authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_web_renderjs_ui: show timezone even if non-editable mode

IN non-editable mode the timezone was never shown even if the field was configured to display it.
parent 30ffec4e
......@@ -257,23 +257,20 @@
offset_time_zone;
if (gadget.state.value) {
state_date = new Date(gadget.state.value);
//get timezone difference between server and local browser
offset_time_zone = timezone +
(state_date.getTimezoneOffset() / 60);
//adjust hour in order to get correct date time string
state_date.setUTCHours(state_date.getUTCHours() +
offset_time_zone);
text_content = state_date.toLocaleDateString(language);
if (!gadget.state.date_only) {
text_content += " " +
formatDateToLocaleFormatString(state_date, language);
}
if (gadget.state.timezone_style) {
text_content = state_date.toLocaleDateString(language);
if (!gadget.state.date_only) {
text_content += " " +
formatDateToLocaleFormatString(state_date, language);
}
} else {
//get timezone difference between server and local browser
offset_time_zone = timezone +
(state_date.getTimezoneOffset() / 60);
//adjust hour in order to get correct date time string
state_date.setUTCHours(state_date.getUTCHours() +
offset_time_zone);
text_content = state_date.toLocaleDateString(language);
if (!gadget.state.date_only) {
text_content += " " +
formatDateToLocaleFormatString(state_date, language);
text_content += " " + ZONE_LIST[timezone + 12][0];
}
}
}
......@@ -406,4 +403,4 @@
return true;
}, {mutex: 'changestate'});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP));
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>983.16851.20471.25753</string> </value>
<value> <string>983.56055.11203.16827</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,8 +246,8 @@
</tuple>
<state>
<tuple>
<float>1587092369.15</float>
<string>UTC</string>
<float>1589358221.58</float>
<string>GMT+0</string>
</tuple>
</state>
</object>
......
......@@ -83,10 +83,9 @@
</tr>
<tr>
<td>assertElementPresent</td>
<!-- Known bug, in non-editable mode the dates are translated to the client timezone as the timezone selector is not shown -->
<td>//div[@data-gadget-scope='field_my_stop_date']//div[@data-gadget-scope='field']//p[contains(text(), '7:00')]</td>
<td></td>
<td>assertText</td>
<td>//div[@data-gadget-scope='field_my_stop_date']//div[@data-gadget-scope='field']//p</td>
<td>glob:*12:00*GMT+5</td>
</tr>
<tr>
......
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