Fix up timezone stuff

This commit is contained in:
2014-12-01 23:32:00 +11:00
parent 9a8ebbb5a8
commit 08a329417d
3 changed files with 7 additions and 6 deletions

View File

@@ -222,8 +222,8 @@ function booking_event_form_submit($form, &$form_state) {
global $event;
$values = $form_state['input'];
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
//date_default_timezone_set(date_default_timezone(FALSE));
//$tz = new DateTimeZone(date_default_timezone(FALSE));
//watchdog('booking', 'Checkboxes when setting buttons: @info', array ('@info' => var_export($checkboxes, TRUE)));

View File

@@ -188,18 +188,19 @@ function _datearray_to_ts($date)
function _datetime_array_to_ts($date)
{
//watchdog('booking', 'Date-time Conversion: @info', array('@info' => var_export($date, TRUE)));
//watchdog('booking', "Date time conversion timezone configured as: @info", array('@info' => date_default_timezone(FALSE)));
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
if (empty($date) || ($date['month'] == '' && $date['day'] == '' && $date['year'] == ''))
return 0;
else
watchdog('booking', "Date array to timestamp: @info", array('@info' => var_export($date, TRUE)));
//else
// watchdog('booking', "Date array to timestamp: @info", array('@info' => var_export($date, TRUE)));
$gmt_ts = mktime($date['hour'], $date['minute'], 0, $date['month'], $date['day'], $date['year']);
$ts = new DateTime("@$gmt_ts");
$ts->setTimezone($tz);
//watchdog('booking', '<pre>Date-time Conversion: @info </pre>', array('@info' => print_r( $ts, true)));
return $ts->format("U");
}

View File

@@ -19,7 +19,7 @@ define('EVENTID', 1);
define('BOOKING_PAYPAL_SUBMIT_URL', 'https://www.paypal.com/cgi-bin/webscr');
define('BOOKING_PAYPAL_SUBMIT_URL_SANDBOX', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
define('BOOKING_PAYPAL_IPN_PATH', 'system/booking_paypal/ipn');
define('date_default_timezone(FALSE)', 'Australia/Sydney');
//define('TIMEZONE', 'Australia/Sydney');
define('BOOKING_DEFAULT_STATE', 'NSW');
//define('CUSTOM_EMAIL_COUNT', 10);
//define('STUDYGROUP_COUNT', 7);