changeset 941fe31687bc in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=941fe31687bc
description:
        Support timedelta in CSV import/export

        issue9220
        review297531002
diffstat:

 CHANGELOG     |  1 +
 src/window.js |  5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r f9099a72ff8f -r 941fe31687bc CHANGELOG
--- a/CHANGELOG Sun Oct 11 16:27:39 2020 +0200
+++ b/CHANGELOG Sun Oct 11 19:04:16 2020 +0200
@@ -1,3 +1,4 @@
+* Format timedelta in CSV export
 * Manage symbol widget
 * Fallback to model name as title
 * Set treeview footer sticky on bottom
diff -r f9099a72ff8f -r 941fe31687bc src/window.js
--- a/src/window.js     Sun Oct 11 16:27:39 2020 +0200
+++ b/src/window.js     Sun Oct 11 19:04:16 2020 +0200
@@ -1964,10 +1964,15 @@
                         Sao.common.moment_format('%X'));
                 } else if (val.isDate) {
                     val = val.format(Sao.common.date_format());
+                } else if (val.isTimeDelta) {
+                    val = Sao.common.timedelta.format(
+                        val, {'s': 1, 'm': 60, 'h': 60 * 60});
                 } else if (!isNaN(Number(val))) {
                     val = val.toLocaleString(
                         Sao.i18n.BC47(Sao.i18n.getlang()));
                 }
+            } else if (val.isTimeDelta) {
+                val = val.asSeconds();
             } else if (typeof(val) == 'boolean') {
                 val += 0;
             }

Reply via email to