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

Timezone '+01:00' does not work #120

Open
juniwalk opened this issue Feb 26, 2024 · 0 comments
Open

Timezone '+01:00' does not work #120

juniwalk opened this issue Feb 26, 2024 · 0 comments

Comments

@juniwalk
Copy link

juniwalk commented Feb 26, 2024

✏️ Describe the bug
Hello, I have issue with timezones from PostgreSQL. Returned date has timezone '+01:00' instead of 'Europe/Prague', generated iCal using this DateTime instance does not work.

↪️ To Reproduce
Provide us a test like this one which shows the problem:

$dtzA = new DateTimeZone('Europe/Prague');	// This works ok!
$dtzB = new DateTimeZone('+01:00');		// I get this from PostgreSQL using doctrine/orm and it does not work.

$startDate = new DateTime('now', $dtzA);
$endDate = new DateTime('+2 hours', $dtzB);

$cal = Calendar::create('Test');
$cal->event(Event::create('Hello, World!')
	->startsAt($startDate)
	->endsAt($endDate)
);
BEGIN:VCALENDAR
VERSION:2.0
PRODID:spatie/icalendar-generator
NAME:Test
X-WR-CALNAME:Test
BEGIN:VTIMEZONE
TZID:Europe/Prague
BEGIN:STANDARD
DTSTART:20231029T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20240331T010000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:+01:00
BEGIN:STANDARD
DTSTART:20230601T111243
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:UTC
BEGIN:STANDARD
DTSTART:20230601T081243
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:65dc47fbe95ee
DTSTAMP:20240226T081243Z
SUMMARY:Hello\, World!
DTSTART;TZID=Europe/Prague:20240226T091243
DTEND;TZID=+01:00:20240226T111243
END:VEVENT
END:VCALENDAR

obrazek
Output on: https://icalvalidator.com/index.html

Assertions aren't required, a simple dump or dd statement of what's going wrong is good enough 😄

✅ Expected behavior
I would expect that TZ +01:00 would work the same way as if I set Europe/Prague.

🖥️ Versions

iCalendar generator: 2.6.0
PHP: 8.3.2

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

No branches or pull requests

1 participant