Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-43480

Invalid date format error when importing CSV DateTime fields with custom date format

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      On a JIRA where the "Date/Time Formats" are customised, a csv import with DateTime fields with a format different from the default "dd/MMM/yy h:mm a" fail to import fields with a message:

      Cannot add value [ 11/03/15 10:27 ] to CustomField Test Date in Issue with summary 'Test Issue for DateTime CSV import'. Exception Message: Invalid date format. Please enter the date in the format "dd/MMM/yy h:mm a".

      Steps to reproduce:

      1. Go to the "Look and Feel" section and set "Complete Date/Time Format" to: dd/MM/yy HH:mm
      2. Create a Custom Field called "Test Date" and type "Date Time Picker" (no need to link it to a screen)
      3. Go to "External System Import" -> "Import from Comma-separated values (CSV)"
      4. Select the CSV file attached to this issue DateTimeTest.csv and click Next
      5. Select a Project and verify the "Date format" is set to dd/MM/yy HH:mm
      6. Map to corresponding fields
      7. Click Next and Begin Import

      Expected Result: Issue with DateTime field imports correctly
      Actual Result: the issue is imported successfully but the "Date Time" fields is not and the error is displayed.

      JIRA logs the following error:

      2015-05-21 16:10:38,088 JiraTaskExectionThread-7 WARN mbadii 970x2777x1 503sx 59.167.133.1,59.167.29.201 /secure/admin/ImporterLogsPage!import.jspa [imports.importer.impl.AbstractDataImporter$1Thread[TP-Processor68,5,main]] Cannot add value [ 11/03/15 10:27 ] to CustomField Test Date in Issue with summary 'Test Issue for DateTime CSV import'. Exception Message: Invalid date format. Please enter the date in the format "dd/MMM/yy h:mm a".
      com.atlassian.jira.issue.customfields.impl.FieldValidationException: Invalid date format. Please enter the date in the format "dd/MMM/yy h:mm a".
            at com.atlassian.jira.issue.customfields.impl.DateTimeCFType.getSingularObjectFromString(DateTimeCFType.java:139)
            at com.atlassian.jira.issue.customfields.impl.DateTimeCFType.getSingularObjectFromString(DateTimeCFType.java:56)
            at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.getValueFromCustomFieldParams(AbstractSingleFieldType.java:230)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.customfields.CustomFieldValueFactory.prepareValueForCustomField(CustomFieldValueFactory.java:55)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.customfields.CustomFieldsUtil.setCustomFieldValueForIssue(CustomFieldsUtil.java:188)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.importExternalCustomFields(DefaultJiraDataImporter.java:1248)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.createIssue(DefaultJiraDataImporter.java:899)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.importIssues(DefaultJiraDataImporter.java:775)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.doImport(DefaultJiraDataImporter.java:401)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:26)
            at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:15)
            at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:528)
            at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:491)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:254)
            at java.lang.Thread.run(Thread.java:745)
      

      Note:

      • The problem doesn't occur when importing the custom date on the CSV into the default "Created Date" or "Resolution Date" fields.
      • The error also happens if using a saved configuration .txt instead of manually setting the date.

      Workaround:

      • On the "Look and Feel" configuration section, revert "Complete Date/Time Format" settings before importing. It can be set back again after the import completes.

      Attachments

        1. DateTimeTest.csv
          0.1 kB
          Mauro Badii

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mfernandezbadii Mauro Badii
              Votes:
              15 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated: