Issue Feature Closed

#87935Use $_SERVER['REQUEST_TIME'] instead of time() for the current time in viewhelper f:date.format()

Dieter Porth 03/16/19, 18:56 updated 05/07/19, 12:10

Description

The Viewhelper f:date.format() use the time()-function, of PHP to get the current time.

$base = $arguments['base'] ?? time();

This line should be replaced by

$base = $arguments['base'] ?? $_SERVER['REQUEST_TIME'];

Reason:
$_SERVER[‘REQUEST_TIME’] contains the starttime of the request. Every call of a Dateviewhelper will use the same ‘current time’.
If a user request a website at near midnight, two calls of time() can worstly generate two different dates with the f:format.date() viewhelper.

http://php.net/manual/en/function.time.php

Reviews 2