close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

dynamic dates are correct on the page but not when written to a .ICS file

Thread began 2/21/2022 9:38 am by Mags | Last modified 3/16/2024 3:43 pm by Sweens | 198 views | 6 replies |

Mags

dynamic dates are correct on the page but not when written to a .ICS file

Hi Ray, got a bit of a strange issue - I have an events page which shows dates and times of events from the database, along with an "add to calendar" button which writes the info to a .ICS file which users can then open to add the event to Outlook etc (I'm using the script from https://gist.github.com/jakebellacera/635416). The times display correctly on the page and I can see when using Inspector that the dates & times in the submission forms for the button are also correct, however when I open the .ICS file an hour is being added onto the given time (although the first one in the list does work properly for some reason!) I'm sure it must be due to daylight saving time as we're currently on winter time in the UK, however I've tried various strtotime syntax and it doesn't make any difference. Could you possibly take a look for me? I can give you a URL if easier but have attached the relevant files.

Sign in to reply to this post

Ray BorduinWebAssist

I think the issue would be on the page: download-ics.php

I may be able to spot it with that file, but the best way to allow me to debug would be to give me a URL and FTP access to debug the live pages and see what is going on that way.

Sign in to reply to this post
Did this help? Tips are appreciated...

Mags

That would be great thanks, much appreciated - details in PM.

*Update: I got it working by adding the following line in the ICS file at line 149:

private function format_timestamp($timestamp) {
$dt = new DateTime($timestamp);
$dt->setTimezone(new DateTimeZone('GMT-1'));
return $dt->format(self::DT_FORMAT);
}

Strangely UTC or GMT didn't work but the above does. I note that PHP doesn't advise using GMT-1 as it's only meant for backwards compatibility, so I don't know if there's an alternative I could use? Not urgent for now since it's working, so only if you have a spare minute!

Sign in to reply to this post

Ray BorduinWebAssist

I think you should be good with that code. You could probably replace the GMT reference with a time zone from here:

https://www.php.net/manual/en/timezones.php

but I'd probably leave well enough alone if it is working.

Sign in to reply to this post
Did this help? Tips are appreciated...

Sweens

Hi Mags

Is there an chance I could have a copy of your page, so I could edit it for a charity site I run? I've been trying to get this working, but I'm not a coder and have no idea what I should be doing! Please see pm

Thanks

Chris

Sign in to reply to this post

Mags

Hi Sweens, sorry I didn't reply sooner - for some reason I didn't get an email telling me someone had replied to this thread, I just happened to spot it whilst browsing.

I've attached the pages in question, hope it helps. I've stripped out a lot of the stuff on the Events page that you don't need. Note I don't actually use this page any more, and it's almost 2 years since Ray helped me with it, so I don't really remember that much about it! If I can be of any further help though, let me know.

Attached Files
ICS.php
download-ics.php
eventsold.php
Sign in to reply to this post

Sweens

Hi Mags

So grateful, thanks very much.

I hadn't subscribed to the thread, so didn't see this until I tried to do the ics thing again. I'll let you know how I gt on.

Thanks again
====================
UPDATE - I've managed to get it working for individual events, as in your example. My next step is to try and get it to insert all events in on go.

I'm so grateful - thanks again.
Chris

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...