Details
-
Type: Task
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 4.2.0-b1
-
Component/s: None
-
Labels:None
Description
In various locations we use php's date() function, often alongside strtotime() to perform date manipulations.
The Date helper currently uses the DateTime library for formatting dates. However, for date manipulation, we will need to allow a given date to be modified, as we do for service renewals, e.g.
$newDate = date('c', strtotime(date('c') . ' +1 month'));
The Date helper should be updated (by the time this task is ready to be done) to include a ::modify() method for allowing strtotime date modifications, e.g.:
$newDate = $this->Date->modify($this->Date->format('c'), '+1 month', 'Y-m-d H:i:s');
It will also use the timezones given to convert between rather than using the server's timezone, like with date().
- Update all locations where date() is referenced to use the Date helper if available. EVERY individual change must be tested
- Some strtotime() calls may be replaced with Date::modify instead
Issue Links
- duplicates
-
CORE-1485 Use DateTime class to calculate service renew dates
- Closed