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

Check if the TZID provided is an invalid time zone #144

Closed
wants to merge 1 commit into from

Conversation

koernchen02
Copy link

As mentioned at 668ea04 I wasn't able to parse my ICS files containing a non-valid DateTimeZoneId W. Europe Standard Time with https://github.com/u01jmg3/ics-parser/tree/v2.0.6, which reopened #116 for me. Since I assume that all changes were done on purpose and there was no mismatch between my composer-installed package and the v2.0.6 release I'm trying to offer this (hopefully none-intrusive) pull request!
Any feedback is much appreciated, since I don't have a lot of experience with pull requests at all!
Best regards

@u01jmg3 u01jmg3 self-requested a review June 22, 2017 18:08
@u01jmg3 u01jmg3 self-assigned this Jun 22, 2017
u01jmg3 added a commit that referenced this pull request Jun 22, 2017
@u01jmg3
Copy link
Owner

u01jmg3 commented Jun 22, 2017

Re-worked your code in 5c30627

if($this->isValidTimeZoneId($dateArray[0]['TZID'])){
$dateTime->setTimezone(new \DateTimeZone($dateArray[0]['TZID']));
}else{
$dateTime->setTimezone($this->defaultTimeZone);
Copy link
Owner

@u01jmg3 u01jmg3 Jun 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume this should be $dateTime->setTimezone(new \DateTimeZone($this->defaultTimeZone));

$dateTime->setTimezone(new \DateTimeZone($dateArray[0]['TZID']));
}else{
$dateTime->setTimezone($this->defaultTimeZone);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time please abide by the PSR-2 standard already used by this repo

@u01jmg3 u01jmg3 removed their assignment Jun 22, 2017
@u01jmg3 u01jmg3 changed the title [FIX] adds a check if the TZID provided via an event is valid Check if the TZID provided is an invalid time zone Jun 22, 2017
@koernchen02
Copy link
Author

Thanks for the feedback!
I configured my IDE to use PSR-2 for future interactions!
Sorry for the extra-work and my misinterpretation of $defaultTimeZone!
Have a nice weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants