Custom Date field format

  • Posts: 100
  • Thank you received: 1
9 years 2 months ago #94854

HI

I want to use the following

%d-%m-%Y %a

for example
26-03-2013 Wednesday.

However, I get an incorrect date format message when I try to select this date. It may not support spaces.

Thanks

Patrick

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2320
  • Hikashop Business
9 years 2 months ago #94970

Hi,

Yes it don't support spaces, you have to use "%d-%m-%Y" only.
You can edit the view "checkout / fields" to add the day if the custom field is the date one. (if you use the custom field in the table order).

Please Log in or Create an account to join the conversation.

  • Posts: 100
  • Thank you received: 1
9 years 2 months ago #95015

HI

I am actually using the field type Date on table Product. If I select under Allow drop down and set it to "only past dates" or "only future dates" then i can set the format of the date as

%d-%m-%Y %a (with a space)

However if I choose "All dates" under allow, then I get the message "incorrect date format"


Thanks


Patrick

Please Log in or Create an account to join the conversation.

  • Posts: 25265
  • Thank you received: 3910
  • MODERATOR
9 years 2 months ago #95279

Hi,

Please edit the file "administrator/com_hikashop/classes/field.php" and replace the line:

$seps = str_replace(array('.'),array('\.'),$seps);
By
$seps = str_replace(array('.','-'),array('\.','\-'),$seps);
It would solve your problem.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 77
  • Thank you received: 3
8 years 9 months ago #117224

We also want to use a certain date format.
Created a custom field, setup as: Label release date
Table product
Column name releasedate
Format %m-%d-%Y

But on certain products after editing field, it will throw error upon entering product even the display on the edit page is scrambled and messed up. any ideas ?

Thank you

Attachments:
Last edit: 8 years 9 months ago by colpc.

Please Log in or Create an account to join the conversation.

  • Posts: 75529
  • Thank you received: 11766
  • MODERATOR
8 years 9 months ago #117357

Firs,t if you have an old version of HikaShop, updating might be a good idea as we already fixed a few things with the date picker.
Also, there is an issue with custom date fields display because of the calendar function of Joomla 3:
www.hikashop.com/forum/5-support-en-fran...mat-date.html#115554
it requires to change the calendar function of the libraries/joomla/html/html.php file with the code I provided in that other post to make it work properly.

Please Log in or Create an account to join the conversation.

  • Posts: 77
  • Thank you received: 3
8 years 9 months ago #117363

we have the latest HikaShop Business: 2.2.0
and are NOT using joomla 3
What else you got ?

Please Log in or Create an account to join the conversation.

  • Posts: 75529
  • Thank you received: 11766
  • MODERATOR
8 years 9 months ago #117547

There is a similar issue on Joomla 2.5 indeed.
The modification to do to fix the bug is different though.

You need to edit the file libraries/joomla/utilities/date.php and add the line:
if(!is_numeric($date)) $date = strtotime($date);

before the line:
$date = is_numeric($date) ? date('c', $date) : $date;

It will then work fine on 2.5.

Please Log in or Create an account to join the conversation.

  • Posts: 77
  • Thank you received: 3
8 years 9 months ago #117604

OK will give it a shot , & let u know ..

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 77
  • Thank you received: 3
8 years 9 months ago #118143

OK,
I placed the edits into the files you suggested.
But no luck.

Let me explain a little better, perhaps my issue is not a bug ..

Each of our products has a date. This is what we call a release date
Which is a custom field assigned to products. As of now this date format is:
%m/%d/%Y ( though have tried several )
(after no luck ) I have edited the joomla en-GB.ini file to reflect the format as well.
This issue is: the system sees the first number in my case a date for example of 12/08/2006
this being the 12, when I have order set by this field and descending.
Even though we know a date of 1/08/2013 is more recent than the 12/08/2006
the system sees it as 12 before 1 ( in descending order) but that is the month, not year, and so on .
know what I mean ?

In summary: we need a custom date field, with a format of m/d/Y
AND the hikashop system to see and understand the proper date order so we can display
products in descending order as they became available for people to buy.

I hope that makes sense ....

Any Help/ ideas would be great ..

Please Log in or Create an account to join the conversation.

  • Posts: 25265
  • Thank you received: 3910
  • MODERATOR
8 years 9 months ago #118314

Hi,

It makes sense yes.

The problem is that, the custom field date does not store a timestamp in the database. It is something that we want to change with a new kind of date custom field.
The current date custom field store a string of your date in the databse. So depending the date format you choose, you can sort it correctly.

Since HikaShop 1.0.0, we made a lot of improvements on the software and the custom fields have now a lot of new possibilities that we didn't have at the beginning. Now we can store a timestamp in the database and display the date with the selected format. But we need to make this development and we have to keep a retro compatibility because you can have some fields in your database in the older format so... It's not very simple.
In the same time we want to implement a new date picker, stop using the Joomla date picker and have some options and can be easily customized.

So for the moment if you want to sort the values, you have to use the format "%Y/%m/%d", or wait for the improvement of the dates in HikaShop.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 247
  • Thank you received: 4
  • Hikashop Business
5 years 7 months ago #253077

Hello,

1.- How I can change the date format?
Currently is %Y-%m-%d
For more modifications I do always remains the same.

2.- By changing the format, Could I continue to order for this field?

Thanks very much!

Please Log in or Create an account to join the conversation.

  • Posts: 25265
  • Thank you received: 3910
  • MODERATOR
5 years 7 months ago #253081

Hi,

Which custom field type are you using exactly ?

The simple date field is based on the Joomla calendar and if you change the format it will not work anymore on recent version of Joomla ; so the format modification will be refuse if it will generate bad side effects.

Kind regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: dvddvd

Please Log in or Create an account to join the conversation.

  • Posts: 247
  • Thank you received: 4
  • Hikashop Business
5 years 7 months ago #253202

Thanks Jerome,


I have changed Hikashop Date Picker Plugin and now I got to do it.

Please Log in or Create an account to join the conversation.

  • Posts: 247
  • Thank you received: 4
  • Hikashop Business
2 years 10 months ago #309109

Hi Jerome,

I have a custom field with the advanced date picker, and I would like the month to appear in lowercase, since it is the correct way to put it in Spanish, I am not able to achieve it.
It could be done?

Thanks.



Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 247
  • Thank you received: 4
  • Hikashop Business
2 years 10 months ago #309112

Hi Jerome

Sorry I have already solved it, with the translation of Joomla,
Thank you!

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds
Powered by Kunena Forum