Commit d98310ff authored by Romain Courteaud's avatar Romain Courteaud Committed by Boxiang Sun

[erp5_web_renderjs_ui] Display datetime without timezone as UTC when non editable

ERP5 doesn't provide any information about the timezone used internally.
As test doesn't know the selenium browser locale, full text can't be checked.
parent 6b439ae6
......@@ -225,12 +225,25 @@
queue
.push(function (gadget_list) {
var text_content = "",
state_date;
state_date,
options;
if (gadget.state.value) {
state_date = new Date(gadget.state.value);
text_content = state_date.toLocaleDateString();
if (!gadget.state.date_only) {
text_content += " " + state_date.toLocaleTimeString();
if (gadget.state.timezone_style) {
text_content = state_date.toLocaleDateString();
if (!gadget.state.date_only) {
text_content += " " + state_date.toLocaleTimeString();
}
} else {
// We don't know the timezone used by erp5 to store the date
// display it as displayed in editable
options = {timeZone: "UTC"};
text_content = state_date.toLocaleDateString(undefined,
options);
if (!gadget.state.date_only) {
text_content += " " + state_date.toLocaleTimeString(undefined,
options);
}
}
}
p_state.text_content = text_content;
......
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>956.58742.58866.48708</string> </value>
<value> <string>964.14294.33061.33245</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -242,7 +242,7 @@
</tuple>
<state>
<tuple>
<float>1490624147.2</float>
<float>1513610328.86</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -72,16 +72,18 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/go_to_bar_datetime_field_view" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='field_my_start_date']</td>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='field_my_start_date']//div[@data-gadget-scope='field']//p[contains(text(), '11:00:00')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>verifyValue</td>
......@@ -100,6 +102,7 @@
<td>//div[@data-gadget-scope='field_my_stop_date']//select</td>
<td>+0500</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
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