mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
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:
parent
580e2f669a
commit
820cbe618e
@ -33,6 +33,7 @@ class Import < ActiveRecord::Base
|
|||||||
'%Y-%m-%d',
|
'%Y-%m-%d',
|
||||||
'%d/%m/%Y',
|
'%d/%m/%Y',
|
||||||
'%m/%d/%Y',
|
'%m/%d/%Y',
|
||||||
|
'%Y/%m/%d',
|
||||||
'%d.%m.%Y',
|
'%d.%m.%Y',
|
||||||
'%d-%m-%Y'
|
'%d-%m-%Y'
|
||||||
]
|
]
|
||||||
|
|||||||
2
test/fixtures/files/import_dates_ja.csv
vendored
Normal file
2
test/fixtures/files/import_dates_ja.csv
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
subject;start
|
||||||
|
Date in %Y/%m/%d format;2019/05/28;
|
||||||
|
@ -215,6 +215,15 @@ class IssueImportTest < ActiveSupport::TestCase
|
|||||||
assert_equal Date.parse('2015-07-10'), issue.start_date
|
assert_equal Date.parse('2015-07-10'), issue.start_date
|
||||||
assert_equal Date.parse('2015-08-12'), issue.due_date
|
assert_equal Date.parse('2015-08-12'), issue.due_date
|
||||||
assert_equal '2015-07-14', issue.custom_field_value(field)
|
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
|
end
|
||||||
|
|
||||||
def test_date_format_should_default_to_user_language
|
def test_date_format_should_default_to_user_language
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user