Project

General

Profile

Feature #31450 » feature-31450.patch

Mizuki ISHIKAWA, 2019-05-28 09:36

View differences:

app/models/import.rb
33 33
    '%Y-%m-%d',
34 34
    '%d/%m/%Y',
35 35
    '%m/%d/%Y',
36
    '%Y/%m/%d',
36 37
    '%d.%m.%Y',
37 38
    '%d-%m-%Y'
38 39
  ]
test/fixtures/files/import_dates_with_other_format.csv
1
subject;start
2
Valid dates;2015/07/10;
test/unit/issue_import_test.rb
215 215
    assert_equal Date.parse('2015-07-10'), issue.start_date
216 216
    assert_equal Date.parse('2015-08-12'), issue.due_date
217 217
    assert_equal '2015-07-14', issue.custom_field_value(field)
218

  
219
    # Tests using other date formats
220
    import = generate_import_with_mapping('import_dates_with_other_format.csv')
221
    import.settings.merge!('date_format' => Import::DATE_FORMATS[3])
222
    import.mapping.merge!('tracker' => 'value:1', 'subject' => '0', 'start_date' => '1')
223
    import.save!
224

  
225
    issue = new_record(Issue) { import.run }
226
    assert_equal Date.parse('2015-07-10'), issue.start_date
218 227
  end
219 228

  
220 229
  def test_date_format_should_default_to_user_language
(2-2/2)