Support "YYYY/MM/DD" date format when importing issues (#31450).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@18205 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2019-05-30 00:35:10 +00:00
parent 580e2f669a
commit 820cbe618e
3 changed files with 12 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ class Import < ActiveRecord::Base
'%Y-%m-%d',
'%d/%m/%Y',
'%m/%d/%Y',
'%Y/%m/%d',
'%d.%m.%Y',
'%d-%m-%Y'
]

View File

@@ -0,0 +1,2 @@
subject;start
Date in %Y/%m/%d format;2019/05/28;
1 subject;start
2 Date in %Y/%m/%d format;2019/05/28;

View File

@@ -215,6 +215,15 @@ class IssueImportTest < ActiveSupport::TestCase
assert_equal Date.parse('2015-07-10'), issue.start_date
assert_equal Date.parse('2015-08-12'), issue.due_date
assert_equal '2015-07-14', issue.custom_field_value(field)
# Tests using other date formats
import = generate_import_with_mapping('import_dates_ja.csv')
import.settings.merge!('date_format' => Import::DATE_FORMATS[3])
import.mapping.merge!('tracker' => 'value:1', 'subject' => '0', 'start_date' => '1')
import.save!
issue = new_record(Issue) { import.run }
assert_equal Date.parse('2019-05-28'), issue.start_date
end
def test_date_format_should_default_to_user_language