Commit 20900608 authored by Romain Courteaud's avatar Romain Courteaud

[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 b2edbc2f
...@@ -225,13 +225,26 @@ ...@@ -225,13 +225,26 @@
queue queue
.push(function (gadget_list) { .push(function (gadget_list) {
var text_content = "", var text_content = "",
state_date; state_date,
options;
if (gadget.state.value) { if (gadget.state.value) {
state_date = new Date(gadget.state.value); state_date = new Date(gadget.state.value);
if (gadget.state.timezone_style) {
text_content = state_date.toLocaleDateString(); text_content = state_date.toLocaleDateString();
if (!gadget.state.date_only) { if (!gadget.state.date_only) {
text_content += " " + state_date.toLocaleTimeString(); 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; p_state.text_content = text_content;
return gadget_list[0].render(p_state); return gadget_list[0].render(p_state);
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.58742.58866.48708</string> </value> <value> <string>964.14294.33061.33245</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1490624147.2</float> <float>1513610328.86</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -72,16 +72,18 @@ ...@@ -72,16 +72,18 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" /> <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> <tr>
<td>waitForElementPresent</td> <td>assertElementPresent</td>
<td>//div[@data-gadget-scope='field_my_start_date']</td> <td>//div[@data-gadget-scope='field_my_start_date']//div[@data-gadget-scope='field']//p[contains(text(), '11:00:00')]</td>
<td></td> <td></td>
</tr> </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> <tr>
<td>verifyValue</td> <td>verifyValue</td>
...@@ -100,6 +102,7 @@ ...@@ -100,6 +102,7 @@
<td>//div[@data-gadget-scope='field_my_stop_date']//select</td> <td>//div[@data-gadget-scope='field_my_stop_date']//select</td>
<td>+0500</td> <td>+0500</td>
</tr> </tr>
</tbody></table> </tbody></table>
</body> </body>
</html> </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