redminetimesync icon indicating copy to clipboard operation
redminetimesync copied to clipboard

redmine.exceptions.ValidationError: Date is not a valid date

Open jhagberg opened this issue 10 years ago • 6 comments

Trying to sync and get this error

./redminetimesync.py 2
Sync tasks for 09/02/15 ?

Press ENTER to validate ... 


-> Connecting to Redmine...  OK 

* [8.0h #1705]: #1705


Total : 8.0h

Press ENTER to synchronize those tasks ... 

-> Sending entries .
Traceback (most recent call last):
  File "./redminetimesync.py", line 281, in 
    syncToRedmine(time_entries, date, redmine)
  File "./redminetimesync.py", line 169, in syncToRedmine
    comments=time_entry_infos['comment']
  File "/usr/local/lib/python2.7/dist-packages/redmine/managers.py", line 180, in create
    response = self.redmine.request('post', url, data=data)
  File "/usr/local/lib/python2.7/dist-packages/redmine/__init__.py", line 143, in request
    raise ValidationError(to_string(', '.join(e if is_string(e) else ': '.join(e) for e in errors)))
redmine.exceptions.ValidationError: Date is not a valid date

jhagberg avatar Feb 11 '15 09:02 jhagberg

changing in syncToRedmine and add strftime like this spent_on=date.date.strftime("%Y-%m-%d"),

Fixed this error

jhagberg avatar Feb 11 '15 11:02 jhagberg

I never experimented any errors like that one :confused:

Could you give me the Redmine version you're using ?

Thanks

brunetton avatar Feb 13 '15 16:02 brunetton

  Redmine version                2.5.2.stable.13345
  Ruby version                   1.9.3-p125 (2012-02-16) [x86_64-linux]
  Rails version                  3.2.19
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Subversion                     1.6.11
  Git                            1.7.1
  Filesystem                     
Redmine plugins:
  redmine_anonymous_authors      0.0.4
  redmine_anonymous_watchers     0.1.0
  redmine_custom_help_url        0.0.2
  redmine_projects_accordion     0.1.0
  redmine_spent_time             2.6.6
  redmine_timetables             0.0.1
  redmine_unassigned_issues      0.0.1

jhagberg avatar Feb 14 '15 07:02 jhagberg

I wonder if it is anything with the default date format in the locale settings of the operating system, that makes it occur only for us who has something different than MM/DD/YY ?

samuell avatar Feb 23 '15 12:02 samuell

thx @jhagberg , that worked OK. I've experienced this on debian with czech locale connecting to redmine 2.6.0.stable with czech lang used systemwide if that makes any difference

lo0m avatar Aug 10 '15 19:08 lo0m

spent_on=date.date.strftime("%Y-%m-%d"),

Alternatively date.date.date().

barnaba avatar Jul 26 '16 16:07 barnaba