[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - shell/inc shell/source

Muhammet Kara muhammet.kara at pardus.org.tr
Tue Apr 19 23:05:49 UTC 2016


 shell/inc/internal/iso8601_converter.hxx                   |    3 ++-
 shell/source/win32/shlxthandler/util/iso8601_converter.cxx |    9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 95a8f1bb0ad7c040b2c96ef0a509dd74dfe16fd7
Author: Muhammet Kara <muhammet.kara at pardus.org.tr>
Date:   Mon Apr 18 17:18:47 2016 +0300

    tdf#89609 Ignore subsecond precision in iso8601_date_to_local_date
    
    Explorer shell extension fails to convert date
    into locale specific string if it has sub-second
    precision.
    
    Reviewed-on: https://gerrit.libreoffice.org/24220
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    (cherry picked from commit 97dee1df42dc2933d1350eb1e67361674614417a)
    
    Change-Id: I11bd38fc2876aa1f8235dbfb8c7850ff22ac2a8b
    Reviewed-on: https://gerrit.libreoffice.org/24250
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/shell/inc/internal/iso8601_converter.hxx b/shell/inc/internal/iso8601_converter.hxx
index ee68282..570cecb 100644
--- a/shell/inc/internal/iso8601_converter.hxx
+++ b/shell/inc/internal/iso8601_converter.hxx
@@ -25,7 +25,8 @@
 
 /* Converts ISO 8601 conform date/time
    represenation to the representation
-   conforming to the current locale
+   conforming to the current locale,
+   ignoring the milliseconds part if exists
 */
 std::wstring iso8601_date_to_local_date(const std::wstring& iso8601date);
 
diff --git a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
index a033978..e13f977 100644
--- a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
+++ b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
@@ -36,6 +36,15 @@ std::wstring iso8601_date_to_local_date(const std::wstring& isoDate )
 {
     ::std::wstring ws8601DateTime(isoDate);
 
+    // Get rid of the optional milliseconds part if it exists.
+    // Function accepts date/time as a combined date/time string in extended ISO8601 format,
+    // which is yyyy-mm-ddThh:mm:ss[.mmm]. Last part is the optional "fraction of second" part,
+    // that's why we cut off at 19.
+    if (ws8601DateTime.length() > 19)
+    {
+      ws8601DateTime.erase(19, ::std::basic_string<char>::npos);
+    }
+
     if ( ws8601DateTime.length() == 19 )
     {
         std::string asDateTime = WStringToString( ws8601DateTime );


More information about the Libreoffice-commits mailing list