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.
Drupal shows wrong current date examples in May for Date fields, Date formats, etc.
For example, at May 7, 2014 it shows '06/07/2014', or 'Jun 7 2014', etc. I think, that's because of following string in date_example_date() function:
if (date_format($now, 'M') == date_format($now, 'F')) {
date_modify($now, '+1 month');
}
date_format($now, 'M') is equal to 'May', and date_format($now, 'F') is equal to 'May', too. So it adds 1 month to current date.
Comments
Comment #1
intrafusionI can confirm that this issue still exists 3 years later, my content editors find this annoying.
Any reason why this code even exists?
Comment #2
JudyPJHsu CreditAttribution: JudyPJHsu commentedThis is the entire function:
I think this is to disambiguate date examples. Like if the example is 11/11, doesn't help as an example of date, because the user doesn't know which is month or date, so by adding some extra time, like 11/12 and if the current month is 11, then you kind of get that the format is mm/dd and not dd/mm.
For the month of May, it also doesn't 'help' to show 'May' because it tells you nothing about whether the format of the month should be a three letter representation of the month or the entire word of the month, which is why a month is added so you can see whether the format is Jun or June.
Unfortunately, this throws people off because regular users are expecting the example to be today's date/time as it usually is.
Comment #3
szt CreditAttribution: szt commentedI can confirm that this issue still exists 10 years later...