Skip to content
Snippets Groups Projects
Commit ec7be576 authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

Issue #3408418 by alejico, dmitri.daranuta: Quiz Availability (Open/Close)...

Issue #3408418 by alejico, dmitri.daranuta: Quiz Availability (Open/Close) time does only work with GMT time
parent 437eab45
No related branches found
No related tags found
No related merge requests found
......@@ -354,12 +354,10 @@ function quiz_quiz_access(EntityInterface $entity, $operation, AccountInterface
// Make sure this is available.
if (!$entity->get('quiz_date')->isEmpty()) {
// Compare current GMT time to the open and close dates (which should still
// be in GMT time).
$request_time = Drupal::time()->getRequestTime();
$quiz_date = $entity->get('quiz_date')->get(0)->getValue();
$quiz_open = $request_time >= strtotime($quiz_date['value']);
$quiz_closed = $request_time >= strtotime($quiz_date['end_value']);
$request_time = \Drupal::time()->getRequestTime();
$quiz_date = $entity->get('quiz_date');
$quiz_open = $request_time >= $quiz_date->start_date->getTimestamp();
$quiz_closed = $request_time >= $quiz_date->start_date->getTimestamp();
if (!$quiz_open || $quiz_closed) {
if ($user_is_admin) {
$hooks['admin_ignore_date'] = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment