I am at a time zone of GMT+8. I have properly set the Drupal's system at this time zone. Users will not have their own timezone. The OS (Linux) is set to UTC.
When I want to change a MERCI reservation status from "unconfirmed" to "confirmed" that is within a few hours from now, the below message is shown:
You cannot change the status to Confirmed for a reservation that has past.
I have created a validation rule which prevent users from inputing a date and time in the past:
I know that it is the time zone problem because when I use the "field validation" module and added the below rule on the reservation field:
Type: Date range 2
Column: value
Cycle of date: Global
Minimum date: now
Maximum date: empty
Then when users create a MERCI reservation node, this validator is triggered if the input time is within 8 hours from now. I printed the "Custom error message" with the [value] token, and found that the input date is 8 hours earlier than what the user input. i.e. if the user choose 09:00, the [value] prints 01:00. This means that the inputed value is 8 hours earlier than the actual time.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2474859-1.patch | 970 bytes | darrick |
#6 | 2474859.patch | 648 bytes | darrick |
Comments
Comment #1
metakel CreditAttribution: metakel commentedComment #2
metakel CreditAttribution: metakel commentedFurther checking the issue, I found that it only have problem upon saving the reservation. The below error will be shown if the reservation time is within the offset of the timezone.
Other than this, the module honours the site's timezone settings.
The field's Time zone handling is set to: "Sites' time zone".
Comment #3
metakel CreditAttribution: metakel commentedComment #4
darrick CreditAttribution: darrick commentedWhat are your settings for the PHP Default timezone? It's possible it could be inheriting the OS timezone. Try setting it to your timezone if it's not.
Comment #5
metakel CreditAttribution: metakel commentedThank you darrick. I found that my php5-fpm's "php.ini" has not set any default timezone.
I have added it back according to the PHP documentation: http://php.net/manual/en/timezones.asia.php
The "Date API System date settings" on the "Status report" now reads:
However it does not fix the problem.
Comment #6
darrick CreditAttribution: darrick commentedOkay. Try this patch below and let me know if it fixes your issues.
Comment #7
metakel CreditAttribution: metakel commentedThank you again! It seems that the patch works.
I found that the similar problem arises when I use "auto checked out" and "auto checked in": the status does not change at the right time, but 8 hours (my timezone offset) later.
Comment #8
darrick CreditAttribution: darrick commentedTry this patch for the auto checkin/out issue.
Comment #10
darrick CreditAttribution: darrick commentedComment #13
darrick CreditAttribution: darrick commented