Skip to content

Commit 1dfd4db

Browse files
committed
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 PHPOffice#298
1 parent d9bd45f commit 1dfd4db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/PhpSpreadsheet/Style/NumberFormat.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ class NumberFormat extends Supervisor
2525
const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd';
2626
const FORMAT_DATE_YYYYMMDD = 'yy-mm-dd';
2727
const FORMAT_DATE_DDMMYYYY = 'dd/mm/yy';
28-
const FORMAT_DATE_DMYSLASH = 'd/m/y';
29-
const FORMAT_DATE_DMYMINUS = 'd-m-y';
28+
const FORMAT_DATE_DMYSLASH = 'd/m/yy';
29+
const FORMAT_DATE_DMYMINUS = 'd-m-yy';
3030
const FORMAT_DATE_DMMINUS = 'd-m';
31-
const FORMAT_DATE_MYMINUS = 'm-y';
31+
const FORMAT_DATE_MYMINUS = 'm-yy';
3232
const FORMAT_DATE_XLSX14 = 'mm-dd-yy';
3333
const FORMAT_DATE_XLSX15 = 'd-mmm-yy';
3434
const FORMAT_DATE_XLSX16 = 'd-mmm';
3535
const FORMAT_DATE_XLSX17 = 'mmm-yy';
3636
const FORMAT_DATE_XLSX22 = 'm/d/yy h:mm';
37-
const FORMAT_DATE_DATETIME = 'd/m/y h:mm';
37+
const FORMAT_DATE_DATETIME = 'd/m/yy h:mm';
3838
const FORMAT_DATE_TIME1 = 'h:mm AM/PM';
3939
const FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM';
4040
const FORMAT_DATE_TIME3 = 'h:mm';

0 commit comments

Comments
 (0)