From 1dfd4dbeb93439c99f3967ba04220dadd770b120 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sat, 23 Dec 2017 18:28:56 +0900 Subject: [PATCH] Date format compatible with both LibreOffice and Excel Date formats used invalid single `y`, instead of double `yy`. That was was implicitly fixed and displayed correctly by Excel. But LibreOffice does not implicitly fix it and instead display the literal `y` instead of th year value. See also: https://support.office.com/en-us/article/Format-numbers-as-dates-or-times-418bd3fe-0577-47c8-8caa-b4d30c528309 Fixes #298 --- src/PhpSpreadsheet/Style/NumberFormat.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index a0bfd65e..f4731105 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -25,16 +25,16 @@ class NumberFormat extends Supervisor const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'; const FORMAT_DATE_YYYYMMDD = 'yy-mm-dd'; const FORMAT_DATE_DDMMYYYY = 'dd/mm/yy'; - const FORMAT_DATE_DMYSLASH = 'd/m/y'; - const FORMAT_DATE_DMYMINUS = 'd-m-y'; + const FORMAT_DATE_DMYSLASH = 'd/m/yy'; + const FORMAT_DATE_DMYMINUS = 'd-m-yy'; const FORMAT_DATE_DMMINUS = 'd-m'; - const FORMAT_DATE_MYMINUS = 'm-y'; + const FORMAT_DATE_MYMINUS = 'm-yy'; const FORMAT_DATE_XLSX14 = 'mm-dd-yy'; const FORMAT_DATE_XLSX15 = 'd-mmm-yy'; const FORMAT_DATE_XLSX16 = 'd-mmm'; const FORMAT_DATE_XLSX17 = 'mmm-yy'; const FORMAT_DATE_XLSX22 = 'm/d/yy h:mm'; - const FORMAT_DATE_DATETIME = 'd/m/y h:mm'; + const FORMAT_DATE_DATETIME = 'd/m/yy h:mm'; const FORMAT_DATE_TIME1 = 'h:mm AM/PM'; const FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM'; const FORMAT_DATE_TIME3 = 'h:mm';