[Kimchi-devel] [Wok][PATCH 4/7] Multi-Culture support : Format datetime as per locale in wok.list.js

pkulkark at linux.vnet.ibm.com pkulkark at linux.vnet.ibm.com
Wed May 4 05:57:14 UTC 2016


From: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>

co-authored by: Archana Singh <archus at linux.vnet.ibm.com>

This patch formats the datetime fields as per locale
in wok-list widget.

Signed-off-by: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
---
 ui/js/src/wok.list.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/js/src/wok.list.js b/ui/js/src/wok.list.js
index f40b2e2..6edf657 100644
--- a/ui/js/src/wok.list.js
+++ b/ui/js/src/wok.list.js
@@ -123,6 +123,10 @@ wok.widget.List.prototype = (function() {
                 var checkboxName = $('ul', container).parent().parent().parent().attr('id') + '-check' || $(container).parent().parent().parent().attr('id') + '-check';
                 $.each(fields, function(fi, field) {
                     var value = getValue(field.name, row);
+                    if (field.name === 'time') {
+                       var dte = new Date(value.substr(0,10)+'T'+value.substr(11))
+                       value = dte.toLocaleString(wok.lang.get_loc().replace('_','-'))
+                    } 
                     if (field.type === 'status' && field.name === 'enabled') {
                         styleClass = (value === true ? '' : ' disabled');
                         state = [
-- 
2.1.0




More information about the Kimchi-devel mailing list