×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Change format of Calendar (J_Calendar)
Nick Gardei
Yeni Üye
Posts: 10
9 yıl 8 ay önce #688
Yazan: Nick Gardei
Nick Gardei tarafından Change format of Calendar (J_Calendar) - BUG FOUND konusunda yanıtlandı
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");
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Nick Gardei
Yeni Üye
Posts: 10
9 yıl 8 ay önce - 9 yıl 8 ay önce #689
Yazan: Nick Gardei
Nick Gardei tarafından Change format of Calendar (J_Calendar) konusunda yanıtlandı
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.
Son Düzenleme: 9 yıl 8 ay önce Düzenleyen:Nick Gardei Neden: Update formatting for easier reading
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Nick Gardei
Yeni Üye
Posts: 10
9 yıl 8 ay önce #690
Yazan: Nick Gardei
Nick Gardei tarafından Change format of Calendar (J_Calendar) konusunda yanıtlandı
Long story short is this;
Even after changing the preg_match to validate (return true) for my date format the search still fails.
There is yet another place where the preg_match needs to line up - inside the getListQuery() function in the same file.
However this STILL won't work because the data is stored in the table in YYYY-MM-DD format.
Ugh....frustrating for something so simple. I've literally wasted 6 hours so far on this one tiny detail.
Even after changing the preg_match to validate (return true) for my date format the search still fails.
There is yet another place where the preg_match needs to line up - inside the getListQuery() function in the same file.
//Checking "_dateformat"
$filter_date_from = $this->state->get("filter.date_from_dateformat");
if ($filter_date_from && preg_match("/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/", $filter_date_from) && date_create($filter_date_from) ) {
$query->where("a.date >= '".$db->escape($filter_date_from)."'");
}
However this STILL won't work because the data is stored in the table in YYYY-MM-DD format.
Ugh....frustrating for something so simple. I've literally wasted 6 hours so far on this one tiny detail.
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Russell English
Bakır Üye
Posts: 21
9 yıl 8 ay önce - 9 yıl 8 ay önce #691
Yazan: Russell English
Russell English tarafından Change format of Calendar (J_Calendar) konusunda yanıtlandı
Hi Nick, I'm glad it's not just me that was having difficulty with this.
Changing the date format should be a simple procedure and should be managed with a Language override within the CMS itself (as many other components and Joomla itself do).
Thanks for the updates though and for keeping me in the loop.
Changing the date format should be a simple procedure and should be managed with a Language override within the CMS itself (as many other components and Joomla itself do).
Thanks for the updates though and for keeping me in the loop.
Son Düzenleme: 9 yıl 8 ay önce Düzenleyen:Russell English
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Søren Beck Jensen
Yönetici
Posts: 73
9 yıl 8 ay önce #694
Yazan: Søren Beck Jensen
Søren Beck Jensen
Founder, Component-Creator.com
Søren Beck Jensen tarafından Change format of Calendar (J_Calendar) konusunda yanıtlandı
We are looking into the COM_PRUEBA issue and I am happy to report that it looks like someone will be buying "f**k up beer" this Friday, which is tradition when someone makes a stupid mistake in our company. If you are in or around Granada, Spain you are invited.
In relation to making it easier to change the date format, then we will investigate what we can do to make this easier to do.
In relation to making it easier to change the date format, then we will investigate what we can do to make this easier to do.
Søren Beck Jensen
Founder, Component-Creator.com
Şu kullanıcı(lar) Teşekkür etti: Russell English
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Russell English
Bakır Üye
Posts: 21
9 yıl 7 ay önce #790
Yazan: Russell English
Russell English tarafından Change format of Calendar (J_Calendar) konusunda yanıtlandı
Hi Søren, is there any update on this please?
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Sayfa oluşturma süresi: 0.060 saniye