Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in AM/PM conversion when using an escaped space in custom format #557

Closed
deekthesqueak opened this issue Jun 21, 2018 · 0 comments
Closed

Comments

@deekthesqueak
Copy link
Contributor

deekthesqueak commented Jun 21, 2018

This is:

- [x] a bug report

What is the expected behavior?

Dates with escaped spaces in their format should properly handle AM/PM conversion.

What is the current behavior?

Dates formats escaped with a backslash \ do not handle AM/PM conversion correctly.

diff --git a/tests/data/Style/NumberFormatDates.php b/tests/data/Style/NumberFormatDates.php
--- a/tests/data/Style/NumberFormatDates.php
+++ b/tests/data/Style/NumberFormatDates.php
@@ -52,4 +52,14 @@ return [
         22269.0625,
         '[DBNum1][$-804]m"月"d"日";@',
     ],
+    [
+        '07:35:00 AM',
+        43270.315972222,
+        'hh:mm:ss\ AM/PM'
+    ],
+    [
+        '02:29:00 PM',
+        43270.603472222,
+        'hh:mm:ss\ AM/PM'
+    ]
 ]

What are the steps to reproduce?

See test cases above.

Which versions of PhpSpreadsheet and PHP are affected?

Current

See https://github.com/PHPOffice/PhpSpreadsheet/pull/558/files for possible solution.

deekthesqueak added a commit to deekthesqueak/PhpSpreadsheet that referenced this issue Jun 21, 2018
Dfred pushed a commit to Dfred/PhpSpreadsheet that referenced this issue Nov 20, 2018
Fix issue where escaped spaces in cell format would cause incorrect
date format leading to incorrect time conversions

Fixes PHPOffice#557
Closes PHPOffice#558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant