×
This forum has been locked. Please submit new Feature Requests on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Customizable Date Format
Nick Gardei
New Member
Posts: 10
10 năm 2 tuần trước #463
bởi Nick Gardei
Customizable Date Format was created by Nick Gardei
I would like to see an option to select/store the date format when j_calendar fields are used. As I found in several XML files the date format is hard coded for Y-m-d. If the date is not updated in ALL areas issues can arise - for example if the 'filter' fields are displaying/filtering in a different format than the stored data you can get SQL errors when selecting a date range.
A few ways you might go about this;
A few ways you might go about this;
- Use a predefined date format variable from the built-in language packs (DATE_FORMAT_XX, etc)
- Create a component parameter to store the format
- Leave the format 'hard coded', but capture the date format before the component is built (add another field to the component builder)
Những thành viên sau(s) đã Cảm ơn: Russell English
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Nick Gardei
New Member
Posts: 10
10 năm 2 tuần trước - 10 năm 2 tuần trước #473
bởi Nick Gardei
Replied by Nick Gardei on topic Customizable Date Format
As a temporary solution I used PHP 'date' and 'strtotime' functions to convert the format in my view;
Not the cleanest way to do this since I'd like to see the data in the same format everywhere, but it works for now.
<?php echo 'Term Expires '.date("m-d-Y", strtotime($item->term_exp)); ?>
Not the cleanest way to do this since I'd like to see the data in the same format everywhere, but it works for now.
Last edit: 10 năm 2 tuần trước by Nick Gardei.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Russell English
Junior Member
Posts: 21
10 năm 1 tuần trước #479
bởi Russell English
Replied by Russell English on topic Customizable Date Format
I'd like this aswell. It seems madness that the date format is hard coded and not part of the language file.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Andres Maeso
Platinum Member
Posts: 338
10 năm 1 tuần trước - 10 năm 1 tuần trước #481
bởi Andres Maeso
Andrés Maeso
Customer relations manager at Joomla Component Creator.
This email address is being protected from spambots. You need JavaScript enabled to view it.
Replied by Andres Maeso on topic Customizable Date Format
Hello!
Thank you all for your feedback. Joomla doesn't allow us to change the date format for each language. We can work on something for this if this gets more votes.
Regards,
Andrés.
Thank you all for your feedback. Joomla doesn't allow us to change the date format for each language. We can work on something for this if this gets more votes.
Regards,
Andrés.
Andrés Maeso
Customer relations manager at Joomla Component Creator.
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 10 năm 1 tuần trước by Andres Maeso.
Những thành viên sau(s) đã Cảm ơn: Hakan
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Nick Gardei
New Member
Posts: 10
10 năm 1 tuần trước #483
bởi Nick Gardei
I'm not sure I follow...
Joomla stores several date formats in the language files. For example 'DATE_FORMAT_LC3', which is used numerous places in templates for article publish/create dates, etc.
I'm not asking you to reinvent the wheel, just give us the option to create our own date format, then store that format string in the already created language files.
Or an even easier option is to replace your hardcoded 'Y-m-d' with an already existing date format such as 'DATE_FORMAT_LC3'. This way we can update 1 place and the format is changed in all admin/site views.
Replied by Nick Gardei on topic Customizable Date Format
Joomla doesn't allow us to change the date format for each language.
I'm not sure I follow...
Joomla stores several date formats in the language files. For example 'DATE_FORMAT_LC3', which is used numerous places in templates for article publish/create dates, etc.
I'm not asking you to reinvent the wheel, just give us the option to create our own date format, then store that format string in the already created language files.
Or an even easier option is to replace your hardcoded 'Y-m-d' with an already existing date format such as 'DATE_FORMAT_LC3'. This way we can update 1 place and the format is changed in all admin/site views.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Victor
Administrator
Posts: 19
10 năm 1 tuần trước #486
bởi Victor
Back-end developer on Component Creator
Replied by Victor on topic Customizable Date Format
Hi Nick,
I'm Victor, back-end developer of Component Creator.
As you know, DATE_FORMAT_LC* strings are language strings, so you need to use JText::_() method to convert that from the language key to the real language string, but Joomla calendar field doesn't do that by default, so we cannot put that in the XML field. To achieve what you are asking, you need to develop your own calendar field that inherit from JFormFieldCalendar class and overrwite the _get method.
Creating a customizable date field is a big feature that we would love to implement, but first we need to be sure that it will really help a good amount of our users. We will ask in our Social networks to make sure and we will see.
I hope this message clarify your ideas about how to achieve your goal.
Best regards,
Victor.
I'm Victor, back-end developer of Component Creator.
As you know, DATE_FORMAT_LC* strings are language strings, so you need to use JText::_() method to convert that from the language key to the real language string, but Joomla calendar field doesn't do that by default, so we cannot put that in the XML field. To achieve what you are asking, you need to develop your own calendar field that inherit from JFormFieldCalendar class and overrwite the _get method.
Creating a customizable date field is a big feature that we would love to implement, but first we need to be sure that it will really help a good amount of our users. We will ask in our Social networks to make sure and we will see.
I hope this message clarify your ideas about how to achieve your goal.
Best regards,
Victor.
Back-end developer on Component Creator
Những thành viên sau(s) đã Cảm ơn: Hakan
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Thời gian tải trang: 0.060 giây