Commit 6bcbd1ed authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Format read only datetime

Localization should be done by fetching the locales and provide it as parameter to toLocaleDateString.
parent 8ba497dc
...@@ -224,8 +224,14 @@ ...@@ -224,8 +224,14 @@
} else { } else {
queue queue
.push(function (gadget_list) { .push(function (gadget_list) {
p_state.text_content = gadget.state.value; return RSVP.all([
return gadget_list[0].render(p_state); gadget_list[0],
gadget.getTextContent()
]);
})
.push(function (result_list) {
p_state.text_content = result_list[1];
return result_list[0].render(p_state);
}); });
} }
return queue; return queue;
...@@ -341,7 +347,16 @@ ...@@ -341,7 +347,16 @@
}) })
.declareMethod('getTextContent', function () { .declareMethod('getTextContent', function () {
return this.state.value || ""; var result = "",
date;
if (this.state.value) {
date = new Date(this.state.value);
result = date.toLocaleDateString();
if (!this.state.date_only) {
result += " " + date.toLocaleTimeString();
}
}
return result;
}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.45772.6944.63351</string> </value> <value> <string>955.33816.11447.60450</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>1479375786.87</float> <float>1480083572.88</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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