tracks icon indicating copy to clipboard operation
tracks copied to clipboard

Saving a Tickler crashes with ArgumentError (invalid date) when German user locale preference set

Open haslinger opened this issue 5 years ago • 1 comments

Saving a tickler results in a server error:

Started POST "/todos" for 94.136.7.87 at 2020-03-08 08:17:17 +0100
Processing by TodosController#create as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ocS8gGlyJZlbe6hKlaUAHlxq3CfxCwF4Dru+NOVlIDv46AwfzKe+xXaYELQfjyLlPr+VjQvG1d0gdqHu5wsYRA==", "default_project_name"=>"", "default_context_name"=>"Wohnung", "new_todo_starred"=>"false", "todo"=>{"description"=>"Borgbackup", "notes"=>"double check if cache deletion and check repair is necessary for all repos", "due"=>"15. März 2020", "show_from"=>"02. März 2020"}, "project_name"=>"", "context_name"=>"Computer", "initial_tag_list"=>"", "tag_list"=>"", "predecessor_input"=>"", "predecessor_list"=>"", "_source_view"=>"deferred", "_group_view_by"=>"context", "_tag_name"=>""}
User Load (0.9ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
Preference Load (1.1ms)  SELECT  `preferences`.* FROM `preferences` WHERE `preferences`.`user_id` = 1 LIMIT 1
Context Load (1.1ms)  SELECT  `contexts`.* FROM `contexts` WHERE `contexts`.`user_id` = 1 AND `contexts`.`name` = 'Wohnung' ORDER BY position ASC LIMIT 1
Context Load (1.1ms)  SELECT  `contexts`.* FROM `contexts` WHERE `contexts`.`user_id` = 1 AND `contexts`.`name` = 'Computer' ORDER BY position ASC LIMIT 1
Completed 500 Internal Server Error in 16ms (ActiveRecord: 4.3ms)
ArgumentError (invalid date):
app/models/preference.rb:20:in `strptime'
app/models/preference.rb:20:in `parse_date'
app/controllers/todos/todo_create_params_helper.rb:82:in `parse_dates'
app/controllers/todos_controller.rb:99:in `create'

Switching back the user preference locale to en fixes the issue (so it's no deal breaker at all).

haslinger avatar Mar 08 '20 07:03 haslinger

I bet it's because the app is sending a localized string as the due and show_from dates, like this snippet from your example:

"due"=>"15. März 2020"

Why we're not using ISO-8601 here is baffling. Thanks for reporting.

mattr- avatar Mar 11 '20 15:03 mattr-