×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Change format of Calendar (J_Calendar)
Russell English
Junior Member
Posts: 21
10 năm 3 tuần trước #445
bởi Russell English
Change format of Calendar (J_Calendar) was created by Russell English
Is there anyway to change the format of the date that is created when selecting a date from the J_Calendar?
It appears to be in DATE_FORMAT_LC4 , but I can't find this to create a content override
It appears to be in DATE_FORMAT_LC4 , but I can't find this to create a content override
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 3 tuần trước - 10 năm 3 tuần trước #448
bởi Russell English
Replied by Russell English on topic Change format of Calendar (J_Calendar)
Thanks Andres, just found the XML file I need to edit.
Last edit: 10 năm 3 tuần trước by Russell English.
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
9 năm 11 tháng trước #480
bởi Russell English
Replied by Russell English on topic Change format of Calendar (J_Calendar)
I've tried editing the XML file, but it's not working correctly. Also, accourding to your wiki here www.component-creator.com/wiki/index.php...ndar_(Date_Selector) there should be a format option within the field editor in Component Creator, but there doesn't appear to be.
Any ideas please?
Any ideas please?
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
9 năm 11 tháng trước #495
bởi Russell English
Replied by Russell English on topic Change format of Calendar (J_Calendar)
Thanks Andres, I've tried to change the date format (in the XML) to ="%d-%m-%Y" from here docs.joomla.org/Calendar_form_field_type but for some reason, whenever the date is entered (using the component created by component-creator) and then saved, the date is saved as 000-00-00
I've tried this on several components as outputted by component-creator and they all give the same result.
Any ideas?
I've tried this on several components as outputted by component-creator and they all give the same result.
Any ideas?
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
9 năm 8 tháng trước #688
bởi Nick Gardei
Replied by Nick Gardei on topic Change format of Calendar (J_Calendar) - BUG FOUND
I modified my form XML file as Russell pointed out here - www.component-creator.com/wiki/index.php...ndar_(Date_Selector) to change the format of the date generated in the date selector. As expected, this date format did not match up with the search function and an error was returned;
COM_PRUEBA_SEARCH_FILTER_DATE_FORMAT
Since the name of my component is 'com_boardmeeting' and not 'com_prueba' this seemed odd to me, so I did some digging. In the site side 'meetings' model I found this;
Sure enough I have this entry in my language file, but prefixed with my component name. After changing 'PRUEBA' to 'BOARDMEETING' the readable error from the language file shows up.
COM_PRUEBA_SEARCH_FILTER_DATE_FORMAT
Since the name of my component is 'com_boardmeeting' and not 'com_prueba' this seemed odd to me, so I did some digging. In the site side 'meetings' model I found this;
if ($error_dateformat)
{
$app->enqueueMessage(JText::_("COM_PRUEBA_SEARCH_FILTER_DATE_FORMAT"), "warning");
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
9 năm 8 tháng trước - 9 năm 8 tháng trước #689
bởi Nick Gardei
Replied by Nick Gardei on topic Change format of Calendar (J_Calendar)
Now with the error at least showing correctly I know I'm on the right path to changing the date format.
It appears that if I modify this function the search may work (or at least not return the error). I'll report back for Russells sake when I'm done tinkering.
(In the same model file that I found the bug)
I would like to stress that the ability to change the date format for a component centrally, even if not in a language file would be much appreciated. I personally prefer the default Y-M-D format since it's easily understandable anywhere in the world, but several times now I have needed to change it in a component or my customer would not accept.
It appears that if I modify this function the search may work (or at least not return the error). I'll report back for Russells sake when I'm done tinkering.
(In the same model file that I found the bug)
private function isValidDate($date)
{
return preg_match("/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/", $date) && date_create($date);
}
I would like to stress that the ability to change the date format for a component centrally, even if not in a language file would be much appreciated. I personally prefer the default Y-M-D format since it's easily understandable anywhere in the world, but several times now I have needed to change it in a component or my customer would not accept.
Last edit: 9 năm 8 tháng trước by Nick Gardei. Lý do: Update formatting for easier reading
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.059 giây