Active
Project:
Date
Version:
7.x-2.x-dev
Component:
Date API
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 May 2014 at 18:36 UTC
Updated:
23 Jan 2024 at 23:45 UTC
Jump to comment: Most recent
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 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 commentedI can confirm that this issue still exists 10 years later...