Closed (outdated)
Project:
Date
Version:
6.x-2.x-dev
Component:
Views Filter
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 May 2009 at 15:28 UTC
Updated:
6 Feb 2018 at 01:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
merlinofchaos commentedThe input format for the exposed date filters is anything that can be read by strtotime(), so mm/dd/yyyy should work just fine with no changes.
Comment #2
enboig commentedI have the same problem, I need date filter to be able to handle DD/MM/YYYY, not MM/DD/YYYY; I think a way of doing this would be a field when defining the date filter where you could customise the input with something like "[day]/[month]/[year]".
It would be useful then to be able to add a description line telling what date format does the filter expect.
Comment #3
merlinofchaos commentedSorry, what you get is what strtotime() supports. If it doesn't support that format, then you don't get it.
Comment #5
garyh commentedHi,
I don't understand fully. I want to change the format to DD/MM/YYYY, under my date field it automatically set to:
Format: 2009-06-25
I want this default to always read
Format: 25-06-2009
It must be DD/MM not MM/DD.
Thanks,
Gary
Comment #6
garyh commentedHi,
The problem is actually a limitation of the Date module, see: http://drupal.org/node/444022
Thanks for the feedback here anyhow.
Thanks,
Gary
Comment #7
enboig commentedI don't agree about this being a limitation of Date. I think it would be 'easy' to add options to configure 'views date filter' so you could select arguments order:
- day month year
- month day year
- year month day
- ....
Anything which isn't 'numeric' could be treated as a separator; so it would be possible using mktime() to "reorder" the date.
If actual arguments is left as 'default' I don't think anything will break.
I don't know anything about filters right now, but as I am interested in this functionallity, with some help I will try it and test it.
Comment #8
cimo commentedSubscribing, this input format looks weird for a normal user..
Comment #9
sirpy commentedI've encountered the same problem, a simple solution requires to hard code the format in the code.
in the date_api_filter_handler, in the function date_parts_form, enter whatever format you want in the $format variable.
when the date is parsed back the date api can parse almost any format automaticly, so you should be fine.
Comment #10
enboig commentedIn PHP 5.3 there is a function called "date_parse_from_format()" which is similar to strtotime() but allows you to define custom format. I have ported it to PHP (it can be improved a lot). Right now I need to:
1. Include "date_parse_from_format()" definition (just if needed) in some module (maybe date_api?).
2. Add an option in views date filter to define date format according to date() function
3. Change views to use date_parse_from_format() and not strtotime() if date format is defined
My version of date_parse_from_format is:
Comment #11
dawehnerThat's probably a feature for the date module, so move the module.
Comment #12
enboig commentedI just created a module using hook_form_alter() to add options to views date filter to choose date format. It also uses date_popup to choose date.
Any comment/fix wellcome
Comment #13
enboig commentedI just posted a new version at #502824: Date format in exposed filter (views); now it support between operator.
Comment #14
damienmckennaWe're sorry but the D6 release of Date module is no longer being supported. You are encouraged to update to Drupal 7 or 8, or direct questions to Drupal Answers.