VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: jjk on September 15, 2011, 13:54:21 PM

Title: Shop date format issue
Post by: jjk on September 15, 2011, 13:54:21 PM
When I change the 'Shop date format'  format in VM2 SVN Revision 4114 configuration "%d/%m/%y" and click on 'Coupons' - 'New' thereafter, I get the following error message:
DateTime::__construct() [datetime.--construct]: Failed to parse time string (15/09/11) at position 0 (1): Unexpected character
Title: Re: Shop date format issue
Post by: Studio 42 on September 15, 2011, 14:44:47 PM
First you have to know is J1.7 dont use this format anymore
date are now with no % as PHP date function (joomla 1.5 used sprint_f)
joomla 1.7 date y/m/d
joomla 1.5 date y%/%m/%d

But its strange you have a failure, i want to delete this because the date is not generated by this string (can be in coupon i have mis this).
Due to integration of the format by langue the date format are from Joomla or Virtuemart(next step, i mean, we use only virtuemart format then you can change the formating for your shop and add new in the language keys)
We try now to use convention y/m/d in france for eg., but i have to write a wiki page for the translaters to give the reference/convention link.

If you want to change the dates format you have now to modify the language string but this must be use the local convention in original language key.
Title: Re: Shop date format issue
Post by: jjk on September 15, 2011, 14:53:26 PM
Thanks for the info!

Might be a a Joomla bug. See here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=20826 (http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=20826) (scroll to the bottom of the page)
I didn't check if there is a corresponding post on github already.
Title: Re: Shop date format issue
Post by: Studio 42 on September 16, 2011, 11:05:29 AM
Hi jjk,

PLz try to update from SVN.
I have do a correction for this

Greets,
Patrick
Title: Re: Shop date format issue
Post by: jjk on September 16, 2011, 13:09:04 PM
Hi,

I'm not shure - what did you change? Should it be possible now to change the default date format in the BE 'Configuration' - 'Shop' - 'Shop date format' field from "%m/%d/%y" to a different setting, i.e. "d/m/y" without triggering the error on the 'Orders & Shoppers' - 'Coupons' - 'New' view?

I just tried a few different formats again, but still got for exemple: "500 - An error has occurred.
DateTime::__construct() [datetime.--construct]: Failed to parse time string (d-m-y) at position 1 (-): Unexpected character
or
DateTime::__construct() [datetime.--construct]: Failed to parse time string (16/09/11) at position 0 (1): Unexpected character (after entering %d/%m/%y)

I would prefer a format that displays "Day-Month-Year" rather than the american "Month-Day-Year"
Title: Re: Shop date format issue
Post by: Milbo on September 16, 2011, 17:07:19 PM
the best is anyway year, month, day.
Title: Re: Shop date format issue
Post by: jjk on September 16, 2011, 18:02:27 PM
I disagree  ;D  (concerning using VM2 in european countries)
However, meanwhile I found a solution that displays "Day/Month/Year". After adding the corresponding keys/strings from the french language file, you just have to leave the 'Configuration - Shop Settings - Shop date format' entry field empty.

... I guess I have to update the german language files again...

BTW - I just noticed something in the BE com_virtuemart.ini:
COM_VIRTUEMART_DATE_FORMAT_INPUT_JS="y.mm.dd" ยป is the single "y" character correct or is this a typo and should read "yy" or "yyyy"?
Title: Re: Shop date format issue
Post by: Milbo on September 16, 2011, 20:55:59 PM
Quote from: Milbo on September 16, 2011, 17:07:19 PM
the best is anyway year, month, day.

I just meant what would be the best, like ISO standard. or year, day, month.... in fact day, month, year is big nonsense.
Title: Re: Shop date format issue
Post by: jjk on September 16, 2011, 22:57:31 PM
...but we proponents of Day/Month/Year are the vast majority on the globe  ;D
See here: http://en.wikipedia.org/wiki/Date_format_by_country (http://en.wikipedia.org/wiki/Date_format_by_country)
Title: Re: Shop date format issue
Post by: Milbo on September 18, 2011, 12:33:08 PM
When I set a standard, I dont care about majorities. I am a ***obscenity removed*** technician, choosing what would best serve the purpose.

ISO standard of meters and kilometers was choosen by logic, not what is most spread (we would have pounds and miles in that case)
Title: Re: Shop date format issue
Post by: Studio 42 on September 28, 2011, 05:22:18 AM
COM_VIRTUEMART_DATE_FORMAT_INPUT_JS is for javascript date picker

only modify it if you use another date picker

Title: Re: Shop date format issue
Post by: jjk on September 28, 2011, 08:30:21 AM
Quote from: Electrocity on September 28, 2011, 05:22:18 AM
COM_VIRTUEMART_DATE_FORMAT_INPUT_JS is for javascript date picker
only modify it if you use another date picker

Do you mean the string in the ini file should only be changed if you use another date picker?

At present I have an notice on the 'Orders & Shoppers' - 'Revenue Report' again showing:
Notice: Undefined property via __get(): _date in ...\administrator\components\com_virtuemart\models\report.php on line 66 in D:\xampp\htdocs\J17vm2svn\libraries\joomla\utilities\date.php on line 231
Notice: Undefined property via __get(): _date in ...\administrator\components\com_virtuemart\models\report.php on line 68 in D:\xampp\htdocs\J17vm2svn\libraries\joomla\utilities\date.php on line 231

Maybe this is due to updating to Joomla 1.7.1 yesterday. There has been a Joomla bug fix concerning the date format.
Title: Re: Shop date format issue
Post by: Studio 42 on October 14, 2011, 12:02:44 PM
hi,
we do next an virtuemart function because joomla always change it and at end the function to resolve the bugs are bigger then a new virtuemart function
Title: Re: Shop date format issue
Post by: Robert_ITMan on February 20, 2013, 23:20:05 PM
Thanks to above for pointing me in the right direction as your info was enough for me to get this working for my sites. I wanted the result showing in the field to show in ISO format 2013-02-20 when using the datepicker instead of 13.02.20 and I found it in 2 places, better to edit the first so it's in the language file - the second I point out because it refers to a different value than that pointed out previously - which is why it didn't fix our problem:

(1) in the language file \language\en-GB\en-GB.com_virtuemart.ini

COM_VIRTUEMART_DATE_FORMAT_INPUT_J16="yy-m-d"
(notice several lines above this that should be changed aswell)

(2) at line 1238 in \administrator\components\com_virtuemart\helpers\config.php

$dateFormat =  JText::_('COM_VIRTUEMART_DATE_FORMAT_INPUT_J16');//="m/d/y"

Hope this note helps someone.