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 @@
} else {
queue
.push(function (gadget_list) {
p_state.text_content = gadget.state.value;
return gadget_list[0].render(p_state);
return RSVP.all([
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;
......@@ -341,7 +347,16 @@
})
.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 () {
......
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.45772.6944.63351</string> </value>
<value> <string>955.33816.11447.60450</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -242,7 +242,7 @@
</tuple>
<state>
<tuple>
<float>1479375786.87</float>
<float>1480083572.88</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