When selecting the default "Short" as the Formatter and a custom made date format as the Format, the default formatter ("Short") is eventually being used instead of the custom date format ("Date only" - see attached screenshot) (as designated in format).
When I select my custom made date as the Formatter ànd as the Format, it's printing one long string of different date formats: PMvr, 17 Dec 2010 16:15 +0100vr, 17 Dec 2010 16:15 +0100pm10 vr, 17 Dec 2010 16:15 +0100vr, 17 Dec 2010 16:15 +0100.
It's also experiencing trouble displaying the preview in Views itself.
- Is this bug already reported / fixed?
-
What is the actual difference between the date formatter and the date format?
Comments
Comment #1
knalstaaf commentedThis has been reported in the issues of Date as well (unreplied since feb. 12th 2011): Problem using custom date type in view.
I'm not sure whether this is a Views or a Date issue...
Comment #2
knalstaaf commentedI'm also getting this alert on top of the Views UI:
Comment #3
dawehnerThis seems to be a date module problem. The date module function date_field_views_data_alter seems to be wrong.
Comment #4
knalstaaf commentedComment #5
knalstaaf commentedComment #6
valderama commentedsubscribing
Comment #7
steinmb commentedHi.
I think also we are seeing this bug using Views 3 beta3 and PHP 5.2.6. Did some tests, and I think that it is not only custom date formats in the view that are triggering this problem, but also localized date, then changing from custom to short format still throw these errors.
Comment #8
nuezsubscribe
Comment #9
metalrom commentedsubscribing
Comment #10
druper commentedsubscribe
Comment #11
siddhy commentedsubscribe
Comment #12
arlinsandbulte commentedDate 7.x-1.x is unsupported.
This issue should be verified in the latest version of Date (7.x-2.x-dev) and re-opened if still valid.
Thanks
Comment #13
dilari commentedI think I just ran into the same problem but using
views 7.x-3.0
and date 7.x-2.0-rc1
My custom format is: " l j M Y "
which gives: "thursday 12 jan 2012"
but in views this is rendered as: th, 12/01/2012 - 15:29
*Edit*
now that I've looked into it a little further, it seems to be a views issue. The rendered/formatted value is available in the data, but it's wrong when selecting it from the dropdown as field formatter.
Comment #14
arlinsandbulte commentedI think there was an issue a while ago about needing to clear the cache for the date format to show up in views... may or may not be related (it is a D6 issue):
#277077: "Custom format" not available in Views immediately - Clearing the cache is required
Comment #15
dilari commentedthanks for the reply. Unfortunately that does not solve it. Cleared cache more than once. Also resaving the contenttype does not help.
The thing is: The formats are available but they have the wrong format.
I've posted a new issue here: http://drupal.org/node/1402922
Comment #16
karens commentedShould be fixed with this commit:
http://drupalcode.org/project/date.git/commit/e8b1933
Comment #17
dilari commentedIndeed it is. Thanks for that KarenS !
Comment #18
Petr Gromov commentedI don't know why, but it adds midi format to my one.
For instance, I have "9 Jan" and it is rendered as "9 Jan 9 January, 2012 - 15:15"
Comment #19
Petr Gromov commentedI have found that somehow inside date_format_date function wierd data is passed: $type is set to "custom" and $format is set to "". If I were you I vould add this validation to date_format_date function.
Comment #20
dilari commented@Petr Gromov: You 're right. Thanks
Comment #22
joachim commentedI'm on 7.x-2.2. which looking at the dates should have this fix, but I'm not seeing it.
In the 'formatter' I see:
- date and time
- time ago
- plain
Both 'date and time' and 'plain' give me the same dependent dropdown, 'Choose how users view dates and times: ' which just shows the formats defined system-wide.
What I'm expecting to see is the ability to enter a PHP date format string for just this Views field, as as I can for the node creation field.
Comment #23
arlinsandbulte commented#22 is a different issue.
But, if I understand correctly, #22 is "works as designed".
You must define a custom date format at 'admin/config/regional/date-time'
Then, you can choose that format for display. Which is available globally.
This is different than the input format, where you can either choose from a list of pre-defined input formats, or create your own custom input format, which is not global, but a per-field setting.
So, there are two different date formats:
Display formats are defined globally, and any date field can use them.
Custom Input formats are defined per-field, and only that field.
Comment #24
PeteS commentedI am completely baffled by this issue. Looking through the code, it seems as though there are only two options: use the "Plain" formatter, which completely ignores whatever format is chosen, or "Date and Time," which seems to be able to apply a custom format, but to a date and time pair. I just don't understand why the architecture for the Views/Date stuff is so convoluted... isn't this like the #1 most obvious scenario that people are going to encounter when using dates in a view? To be able to control what it looks like?
Comment #25
joachim commentedDitto.
Other Views field handlers that show dates let you give a specific format just for that field. One advantage there is that it can be baked into a Feature along with that view, whereas (AFAICT) date formats are site configuration that can't be exported.
Surely the handlers in use here can inherit from / make use of the functionality in core Views?
Comment #27
joachim commentedFiled a new issue for #22 - #25: #1504202: Allow entering of custom date format in Views field handlers
Comment #28
malcolm commentedI've been scratching my head on this one for awhile, then revisited the Date/Time format screens. After you make your Date/Time format here: admin/config/regional/date-time/formats, you need to add it to your system here: admin/config/regional/date-time. (Holy Mother of God!)
Once you do that your custom format will show up on your Views date field format options, and on your Content Type's display options.
Comment #29
dealancer commentedIt is not still not working for me in Date 2.6 and Views 3.5. Going to date formats page and saving this page solved problem for me.
Comment #30
jakemonO commentedI add a custom format (g:h A - i.e. 10:10 AM) in admin/config/regional/date-time/formats, then I create a new date type in admin/config/regional/date-time and choose the new custom time format. Then from the calendar, I choose the new type. The displayed times in my calendar view are off by varying factors. For example, one time of 4:25 PM becomes 4:04 PM in the calendar and another time of 8:45 PM becomes 8:08 PM. There doesn't seem to be any rhyme or reason to the new time values other than they are within the hour of the actual time value. If I use a system defined date type, though, all displays fine. Is this an issue with the custom formatters? I'm not really sure how to proceed with this problem...
Core: 7.23
Calendar: 7.x-3.4
Date: 7.x-2.6
Views: 7.x-3.7
Feeds: 7.x-2.0-alpha8+8-dev
UPDATE 11/17/2013 - strike this issue, I entered an incorrect custom format.