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

Issue 3496 #3498

Merged
merged 5 commits into from
Sep 11, 2023
Merged

Issue 3496 #3498

merged 5 commits into from
Sep 11, 2023

Conversation

campbell-m
Copy link
Contributor

Fix for Issue #3496

@William-Haller
Copy link

This isn't highlighting the last day of the week, last day of the month, and highlights the day before the date in date mode. I restarted the memcached, fpm and apache on both servers to try to make sure the proper code was being served. Unless I just really missed something in doing the change on my end this switches to the opposite problem (UTC) being a day ahead of us at times. Could be changing to a noon vs midnight as I did in my change helped as well, but this doesn't seem to be a solution.

@campbell-m
Copy link
Contributor Author

What do you have $weekstarts set to?

@campbell-m
Copy link
Contributor Author

Could you post a screenshot of what you are seeing please?

@campbell-m
Copy link
Contributor Author

Also, could you post your copy of datepickr.js.php that you are using please?

@campbell-m
Copy link
Contributor Author

@William-Haller - just wondering if you've had a chance to look at my comments?

@William-Haller
Copy link

William-Haller commented Sep 11, 2023

The following information reflects the timezone details as seen in the javascript captured via console.log for week range

TZ = 360 weekStart date =  Sun Sep 03 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:47 TZ = 360 weekStart date =  Sun Sep 03 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:54 TZ = 360 weekEnd date =  Fri Sep 08 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:82 TZ = 360 datesInRange d =  Sat Sep 02 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:83 TZ = 360 datesInRange e =  Thu Sep 07 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:47 TZ = 360 weekStart date =  Sun Sep 03 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:47 TZ = 360 weekStart date =  Sun Sep 03 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:54 TZ = 360 weekEnd date =  Fri Sep 08 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:82 TZ = 360 datesInRange d =  Sat Sep 02 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:83 TZ = 360 datesInRange e =  Thu Sep 07 2023 18:00:00 GMT-0600 (Mountain Daylight Time)

for month range

TZ = 360 monthStart date =  Fri Sep 01 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:69 TZ = 360 monthEnd date =  Sat Sep 30 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:82 TZ = 360 datesInRange d =  Thu Aug 31 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:83 TZ = 360 datesInRange e =  Fri Sep 29 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:61 TZ = 360 monthStart date =  Fri Sep 01 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:69 TZ = 360 monthEnd date =  Sat Sep 30 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:82 TZ = 360 datesInRange d =  Thu Aug 31 2023 18:00:00 GMT-0600 (Mountain Daylight Time)
datepicker.js.php?ar…=en&v=1693921766:83 TZ = 360 datesInRange e =  Fri Sep 29 2023 18:00:00 GMT-0600 (Mountain Daylight Time)

Not sure where in edit area you would want the timezone to be printed - I'll do that if you want - but Mountain Daylight and 360 minute is the correct offset. A change to 18:00:00 MDT is correct for midnight GMT.

Here is a list of the references to $timezone in the codebase.

./config.inc.php-sample://$timezone = "Europe/London";
./config.inc.php:$timezone = "America/Denver";
./edit_area.php:  global $timezone, $auth;
./edit_area.php: ->addSelectOptions(get_timezone_options(), $timezone, true);
./functions_ical.inc:  global $timezone;
./functions_ical.inc:  $vtimezone = get_vtimezone($timezone);
./functions_ical.inc:  global $mail_settings, $timezone, $default_area_room_delimiter;
./functions_ical.inc:  $vtimezone = get_vtimezone($timezone);
./functions_ical.inc:    $results[] = "DTSTART;TZID=$timezone:" . date(RFC5545_FORMAT, $data['start_time']);
./functions_ical.inc:    $results[] = "DTEND;TZID=$timezone:" . date(RFC5545_FORMAT, $data['end_time']);
./functions_ical.inc:                   (($vtimezone === false) ? ":" : ";TZID=$timezone:") .
./functions_ical.inc:  global $timezone;
./functions_ical.inc:  $vtimezone = get_vtimezone($timezone);
./internalconfig.inc.php:// Check that $timezone has been set
./internalconfig.inc.php:if (!isset($timezone))
./internalconfig.inc.php:  die('MRBS configuration error: $timezone has not been set.');
./systemdefaults.inc.php://$timezone = "Europe/London";
./functions.inc:      $message = 'MRBS configuration error: $timezone has not been set.';
./functions.inc:  global $confirmation_enabled, $confirmed_default, $timezone;
./functions.inc:    mrbs_default_timezone_set($timezone);
./functions.inc:  mrbs_default_timezone_set($timezone);
./functions.inc:  global $timezone;
./functions.inc:    $tz = $timezone;  // default to the current timezone
./functions.inc:  global $timezone;
./functions.inc:  $thisDateTimeZone = new DateTimeZone($timezone);
./lib/IntlDateFormatter.php:  private $timezone;
./lib/IntlDateFormatter.php:    $timezone = null,
./lib/IntlDateFormatter.php:    $this->timezone = $timezone;

Comparing this with the distributed code, the only difference is my initial setting in config.inc.php. This variable is not set in each specific site config.

Had e-mailed this to you on the 5th. Not sure what happened to it.

@campbell-m
Copy link
Contributor Author

Thanks. I'm interested in the timezone that you see when you edit the area in question. Login to MRBS as an admin, go to the Rooms page, select the area in question and click the Edit icon (little pencil). The config setting for timezone just sets the default timezone for new areas. I want to check that your area is actually on MDT and not some other timezone. Although you are seeing MDT in the JavaScript console, that timezone is determined by your browser or PC and not by MRBS.

@William-Haller
Copy link

The timezone appears as Denver in that display, which would be correct.

@campbell-m
Copy link
Contributor Author

OK, thanks. Could you post a screenshot please of the problem you are seeing? Unfortunately I am unable to reproduce the problem, despite changing the timezone in my browser. The PR does fix a problem, but obviously not the problem you are seeing.

@William-Haller
Copy link

Screenshot_20230911_075638
Screenshot_20230911_075522
Screenshot_20230911_075609

No highlighted date in day view although correct day is circled. All other displays are off by one.

@campbell-m
Copy link
Contributor Author

Thanks. And could you also post the copy of datepickr.js.php that you are using please? Just to double-check that you are using the correct version.

@William-Haller
Copy link

datepicker.zip
datepicker.js.php is what is running now. o_ is my mods converting the date to noon vs. midnight and adjusting by time zone. n_datepicker.js.php is what produced the console logs in the earlier post. No difference in displays posted between datepicker.js.php and n_datepicker.js.php. o_datepicker.js.php displays the proper highlighted dates.

@campbell-m
Copy link
Contributor Author

Thanks. I can now reproduce the problem. I had to change my PC's timezone. It seems that changing the sensors in Chrome's development tools wasn't enough.

@campbell-m
Copy link
Contributor Author

OK, I can see the problem. Fix coming up later.

@campbell-m
Copy link
Contributor Author

I've now committed a further fix in 349ee9c. I had fallen foul of this quirk:

"When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as local time. This is due to a historical spec error that was not consistent with ISO 8601 but could not be changed due to web compatibility."

Could you test the latest datepickr.js.php code please?

@William-Haller
Copy link

Works for me. Good work.

@campbell-m campbell-m merged commit 3f88f78 into main Sep 11, 2023
1 check passed
@campbell-m campbell-m deleted the Issue_3496 branch September 11, 2023 16:31
@campbell-m campbell-m linked an issue Sep 11, 2023 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

datepicker.js.php highlighting of selected week/month dates
2 participants