You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@pumpkinball
Thanks! This is a much needed fix! But there are a few issues with this PR:
The comma in the character group, line 39, is wrong. Timezones only start with + and -, not ,. Should just be [+-].
This PR may create a new issue: When the date does not contain a timezone offset, the code throws an exception. According to Xero's documentation, dates may take the form, '/Date(1439434356790)/' or '/Date(1419937200000+0000)/', but this PR does not handle the former case. If $matches[2] is empty, presumably you need fall back to '+0000' before creating the DateTimeZone, e.g., new \DateTimeZone($matches[2] ?: '+0000').
Please fix the broken return type as well, line 30. It says @return $this which was never correct even before this PR, and screws up intellisense. Should be @return \DateTime.
Not critical, but perhaps consider what happens if the pattern doesn't match. The previous version raises a warning but returns a zero date, 1970-01-01 00:00:00.000000. This version raises 3 warnings, and (once the timezone issue is fixed) will also return a zero date. Maybe the safest approach would be to raise a single, clearer warning, and return a zero date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Issue 272 when returning Employee DateofBirthAsDate, now handles birth years before 1970