Closed (fixed)
Project:
Availability Calendars
Version:
7.x-3.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2012 at 11:54 UTC
Updated:
16 Jul 2012 at 10:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
fietserwinI didn't give it much attention because I actually assume people will be using the date popup, thus this being a non issue. However, this is not the 1st request regarding this, so I guess I will have to find out how to integrate this.
Any ideas?
- Use the date part of the short date type (how to get only the date part)?
- Add a date type specific for Availability Calendar and have the user change/localize it over there (= admin/config/regional/date-time/...)?
Reactions would be welcome!
Comment #2
pietrocap commentedMaybe the best choice is letting the user change or localize it in admin/config/regional/date-time/...
Comment #3
gynekolog commentedIt does not work.
Comment #4
fietserwinBecause nothing has been changed yet. It thus still works as before with 1 fixed date format only yyyy-mm-dd (the only date format that everybody in the world understands, but also nobody in the world sees as preferred format)
Comment #5
gynekolog commentedExcuse me and my english, I incorrectly translated post by pietrocap.
If someone really need date format for availability search, edit line 191 in availability_calendar_handler_filter_availability.inc
ex. for 31.01.2012 change
$element['#date_format'] = 'Y-m-d';on
$element['#date_format'] = 'd.m.Y';Comment #6
szt commentedA possible solution using localized date patterns.
It converts a simple pattern from the date_format_short pattern.
Please test it.
Comment #7
fietserwinThank you for your patch. I thought, the issue at hand is about the date format of the date field(s) when using a view to search on availability. That one is not covered by your patch. But still it is a nice feature, so I would love to apply your patch.
Some remarks about your patch:
- The change in the js file is OK.
- Contains white space
- According to the doc, the param to locale_get_localized_date_format() should be an array of languages. So that needs some work.
- Why the short format? The format is shown only and not editable, so a longer format could do better?
- Does date_format_short always exists or should there be a check?
- Perhaps better to define an own date format (that the administrator can fill in admin) or present the administrator a list of existing date formats he can select from in the field display settings form? At first sight, I would opt for the latter.
Comment #8
szt commentedOk, i know my patch is a sort of hacking :)
I didn't find any nice solution to convert php-style patterns to JS-style.
If you look at the date_format table, all the default patterns have the year-month-day parts together somehow ('Y-m-d', 'm/d/Y', 'd/m/Y', 'Y/m/d', 'M j Y', 'Y M j', 'F j, Y', 'j F, Y' etc.).
I'm building a site with 5 languages, and my approach handle these, maybe others as well.
If this direction is pointing forward, i will work on it.
Other possible direction would be a (translatable) config page textbox with the pattern.
Comment #9
fietserwinThis is available in core: admin/config/regional/date-time/types (define date types) and, subsequently, via admin/config/regional/date-time/formats (define allowed date formats for all lcoales) to admin/config/regional/date-time/locale (assign date formats to date types for all available locales).
So, there are ways to use this:
You think you can manage to create it this way?
Comment #10
fietserwinAssigning to myself as to create a todo list for 7.x-3.3. So this will get a solution in the next version.
Comment #11
fietserwinI ended up doing this in a big update:
- Define date formats via the Drupal built in date types (admin/config/regional/date-time).
- Localize these date types in admin/config/regional/date-time/locale.
- Use these date types where needed (Views integration to search on availability, Booking formlet)
- Use the jquery.ui.datepicker.formatDate() function.
- So I had to define a conversion from PHP formatters to datepicker formats.
Comment #12
fietserwinComment #13.0
(not verified) commentedcorrection of a wrong word.