Skip to content

Fix Issue 1441 (isDateTime and Formulas) #1480

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

Merged
merged 8 commits into from
May 24, 2020
Merged

Fix Issue 1441 (isDateTime and Formulas) #1480

merged 8 commits into from
May 24, 2020

Conversation

oleibman
Copy link
Collaborator

This is:

- [ x] a bugfix
- [ ] a new feature

Checklist:

Why this change is needed?

When you have a date-field which is a formula, isDateTime returns false.
#1441

Report makes sense; fixed as suggested. Also fixed a few minor
related issues, and added tests so that Shared/Date and Shared/TimeZone
are now completely covered.

Date/setDefaultTimeZone and TimeZone/setTimeZone were not consistent
about what to do in event of failure - return false or throw.
They will now both return false, which is what Date's function
said it would do in its doc block anyhow. Date/validateTimeZone will
continue to throw; it was protected, but was never called outside
Date, so I changed it to private.

TimeZone/getTimeZoneAdjustment checked for 'UST' when it probably
meant 'UTC', and, as it turns out, the check is not even needed.

The most serious problem was that TimeZone/validateTimeZone does not
check the backwards-compatible time zones. The timezone project
aggressively, and very controversially, "demotes" timezones;
such timezones eventually wind up in the PHP backwards-compatible list.
We want to make sure to check that list so that our applications do not
break when this happens.

I bundled into this change two unrelated testing changes.
I think one of my Html tests could be more bulletproof in the event
that a specific assertion failed.
One of the sample CSV's used backslash before quote for escaping,
but, in fact, Excel doubles the quote. This did not invalidate the
test, but it makes the file look weird. An additional assertion
was added to ensure that the cell's contents are correct.

Resync with base project
When you have a date-field which is a formula, isDateTime returns false.
#1441

Report makes sense; fixed as suggested. Also fixed a few minor
related issues, and added tests so that Shared/Date and Shared/TimeZone
are now completely covered.

Date/setDefaultTimeZone and TimeZone/setTimeZone were not consistent
about what to do in event of failure - return false or throw.
They will now both return false, which is what Date's function
said it would do in its doc block anyhow. Date/validateTimeZone will
continue to throw; it was protected, but was never called outside
Date, so I changed it to private.

TimeZone/getTimeZoneAdjustment checked for 'UST' when it probably
meant 'UTC', and, as it turns out, the check is not even needed.

The most serious problem was that TimeZone/validateTimeZone does not
check the backwards-compatible time zones. The timezone project
aggressively, and very controversially, "demotes" timezones;
such timezones eventually wind up in the PHP backwards-compatible list.
We want to make sure to check that list so that our applications do not
break when this happens.

I bundled into this change two unrelated testing changes.
I think one of my Html tests could be more bulletproof in the event
that a specific assertion failed.
One of the sample CSV's used backslash before quote for escaping,
but, in fact, Excel doubles the quote. This did not invalidate the
test, but it makes the file look weird. An additional assertion
was added to ensure that the cell's contents are correct.
Test members only.
Minor issue in test case. It said $cell could be null.
So I put in assertNotNull($cell). Didn't help.
I will try assertTrue(!is_null($cell) && ...)
If this doesn't fix it, I give up.
Hopefully won't affect decision whether or not to merge.
It wants null !== $cell rather than !is_null($cell).
In my last commit, I said it was my last attempt to satisfy Scrutinizer.
Travis hasn't been a problem, so I will do as it says.
Solution is silly, but seemed effective. We'll see.
@MarkBaker
Copy link
Member

Thank you for the submission

Is it possible to unbundled the two unrelated testing changes, and create separate PRs for each of them?

Per comment from Mark Baker.
@oleibman
Copy link
Collaborator Author

Done. The testing changes have been removed from this PR. I will submit them, plus some other testing changes, through other PRs over the next couple of days.

@MarkBaker MarkBaker merged commit 5dd7e88 into PHPOffice:master May 24, 2020
@MarkBaker
Copy link
Member

Thank you for this, and for the unbundling as requested

@oleibman oleibman deleted the isdatetime branch May 25, 2020 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants