salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Support for dd/mm/yyyy date style based on locale #346

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following commands:

cristian@cristian-asus:~$ google calendar add "test a 2/1/2011 19:00"
cristian@cristian-asus:~$ google calendar add "test b 02/1/2011 19:00"
cristian@cristian-asus:~$ google calendar add "test c 02/01/2011 19:00"
cristian@cristian-asus:~$ google calendar add "test d 2/01/2011 19:00"

give event (a) and (d) correctly placed instead date is note recognized for 
(b), (c) and the event is placed in the current day (or the subsequent 
depending on the current time).

*Please note that I'm using a Calendar localized in italian and thus I give 
dates in d(d)?/m(m)?/yyyy format"

* What is the expected output? What do you see instead?
(a), (b), (c), (d) should give the same result: an event on 2nd January 2011 
from 19:00 to 20:00.

My version of GoogleCL is:
cristian@cristian-asus:~$ dpkg -l googlecl 
[...]
ii  googlecl                          0.9.11-1                          
[...]

My system is:
Linux cristian-asus 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37 UTC 
2010 x86_64 GNU/Linux

My version of python is:

cristian@cristian-asus:~$ dpkg -l python-gdata
[...]
ii  python-gdata                      2.0.8-1.1         
[...]

cristian@cristian-asus:~$ dpkg -l python
[...]
ii  python                            2.6.6-2ubuntu2                    [...]

Please see attached file for details.

Original issue reported on code.google.com by kikkocri...@gmail.com on 27 Dec 2010 at 6:52

Attachments:

GoogleCodeExporter commented 9 years ago
It would seem that it tries to match (m)m/(d)d/(yy)yy, or in other words 
American format. As far as I can tell by glancing at the code, there's no 
localization involved for matching of dates (at the moment?). So most likely 
your event will have been added on the 1st of February rather than the 2nd of 
January.

For good measure, you can see the accepted formats here: 
http://code.google.com/p/googlecl/source/browse/trunk/src/googlecl/calendar/date
.py . Personally, I tend to go for the more standard yyyy-mm-dd.

Original comment by Ward.Muy...@gmail.com on 5 Feb 2011 at 6:35

GoogleCodeExporter commented 9 years ago
This is correct, the standard GoogleCL assumes is month,day,year unless that 
produces an invalid date. Unfortunately the docs are still in dire need of an 
update, so this is hard to notice.

Having locale-based date parsing would be nice, though.

Original comment by tom.h.mi...@gmail.com on 14 Feb 2011 at 3:43

GoogleCodeExporter commented 9 years ago
Sorry for the late reply but this is not my issue: I said that events (a), (d) 
are correctly placed (i.e. following Italian locale), so there are no 
localization issues here.[*]
The problem is that events (b), (c) which should be the same as the others are 
misplaced, please note that the difference between the events are the zeros in 
the day and the month, which is a completely unexpected behavior.

Cristian

[*]therefore I invite to change the title of this bug report, possibly 
something better than my previous "Calendar strange date format", but I repeat 
that this is not a localization issue.

Original comment by kikkocri...@gmail.com on 14 Feb 2011 at 7:41

GoogleCodeExporter commented 9 years ago
It should be possible to give a date in a reliable manner.  Currently, at least 
if the Google account uses a non-US language, the results are almost 
unpredictable.  I use Google in German.  Then, "calendar add" with the 
following arguments produced the following dates in the calendar:

"MyEvent 12/02/2011"  => 13th(sic!) Feb 2011
"MyEvent 12/02/2012"  => 12th Feb 2012
"MyEvent 02/12/2011"  => Date not parsed at all
"MyEvent 2011-12-29"  => 29th Dec 2011
"MyEvent 2011-12-02"  => 2nd Dec 2002(sic!), 14:01--15:01

This is very confusing.  But even worse, there seems to be no general date 
format which always works.

Original comment by torsten....@gmail.com on 22 Nov 2011 at 9:28