Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On cck field settings I have fill default values "Custom value for From date" and "Custom value for To date" with data:
Custom value for From date: first day of previous month 00:00:00
Custom value for To date: last day of previous month 23:59:59
And when I try to save, it didn't save with errors:
- The Strtotime default value is invalid.
- The Strtotime default value for the To Date is invalid.
But in PHP with strtotime function all works normally:
$date_start=strtotime('first day of previous month 00:00:00');
$date_end=strtotime('last day of previous month 23:59:59');
echo date('r',$date_start)."\n".date('r',$date_end)."\n";
outputs:
Sun, 01 Aug 2010 00:00:00 +0400
Tue, 31 Aug 2010 23:59:59 +0400
Why date module didn't accepts this strings?
Comments
Comment #1
arlinsandbulte CreditAttribution: arlinsandbulte commentedThis is by design in the current version of date, but there is another feature request to implement this:
#319195: Set default value to a custom strtotime string (for relative or exact dates)