From c2354e7397f44998691dfe8241e49c5a65f66dcc Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 28 Jan 2023 17:38:32 +0100 Subject: Use DateTimeImmutable for concert date/time. --- includes/giglogadmin-export-ical-handler.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'includes/giglogadmin-export-ical-handler.php') diff --git a/includes/giglogadmin-export-ical-handler.php b/includes/giglogadmin-export-ical-handler.php index 44afbea..c230638 100644 --- a/includes/giglogadmin-export-ical-handler.php +++ b/includes/giglogadmin-export-ical-handler.php @@ -30,11 +30,9 @@ if ( ! function_exists( 'giglogadmin_export_ical_handler' ) ) { $cfullname = $concert->cname() . ' live at ' . $concert->venue()->name() . ', ' . $concert->venue()->city(); $cshortname = substr( $cfullname, 0, 20 ); - $fdate = strtotime( $concert->cdate() ); - $newformat = date( 'Ymd', $fdate ); $filename = sanitize_file_name( - "Concert-{$concert->venue()->name()}-{$newformat}-" + "Concert-{$concert->venue()->name()}-{$concert->cdate()->format( 'Ymd' )}-" . substr( $concert->cname(), 0, 30 ) ); @@ -58,12 +56,7 @@ if ( ! function_exists( 'giglogadmin_export_ical_handler' ) ) { // place the event ->setLocation( "{$concert->venue()->name()}, {$concert->venue()->city()}" ) // set the time - ->setDtstart( - new DateTime( - $newformat . 'T190000', - new DateTimezone( 'Europe/Oslo' ) - ) - ) + ->setDtstart( $concert->cdate() ) ->setDuration( 'PT4H' ); header( 'Content-Type: text/calendar' ); -- cgit v1.2.3