Closed (duplicate)
Project:
Token
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Mar 2012 at 14:04 UTC
Updated:
5 Apr 2012 at 02:37 UTC
What is the logic behind defaulting to REQUEST_TIME for empty date fields?
if ($type == 'date') {
$date = !empty($data['date']) ? $data['date'] : REQUEST_TIME;I have an optional deadline field for which i use a token to display the date. If the deadline isn't set, i don't want the current date to be displayed. I just want it to be empty (or not be replaced so i can remove it after).
As it is now, there is no way to distinguish between an empty field and a filled one.
Comments
Comment #1
jeastham commentedThis becomes a real problem when exporting fields in modules like Fill PDF. If date fields are left blank, the token returns the current date, making it difficult to have optional date fields.
Comment #2
dave reidThis is because we have to match the core behavior. See the system_tokens() function in core. Unfortunately since this bug was not able to be fixed prior to 7.0 release, I don't think we can fix it until Drupal 8 with #943028: 'Date' token namespace is ambiguous