Commit 6f750c29 authored by Jesse Mapel's avatar Jesse Mapel Committed by Jesse Mapel
Browse files

Changed FileName to use US English for date conversions (#3379)

* Changed FileName to use US English for date conversions

* Removed defaulte locale

* Fixed FileList test
parent 7eb8875b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <QDate>
#include <QDebug>
#include <QDir>
#include <QLocale>
#include <QPair>
#include <QString>
#include <QTemporaryFile>
@@ -622,8 +623,7 @@ namespace Isis {
                    foundFile.mid(truncateRange.second + 1);

      }

      QDate fileDate = QDate::fromString(foundFile, fileQDatePattern);
      QDate fileDate = QLocale(QLocale::English, QLocale::UnitedStates).toDate(foundFile, fileQDatePattern);

      if (fileDate.isValid()) {
        // No missions before Sputnik 1, so we must be in the new millenium
+2 −1
Original line number Diff line number Diff line
@@ -110,7 +110,8 @@ namespace Isis {
   *   @history 2017-04-21 Cole Neubauer - Updated documentation for the class Fixes #4121
   *   @history 2018-04-06 Kaitlyn Lee - Moved method documentation to cpp file and
   *                           updated it for consistency. Fixes #5230.

   *   @history 2019-08-07 Jesse Mapel - Replaced QDate::fromFile call with QLocale::toDate
   *                           calls to ensure US English is always used. Fixes #3340
   */
  class FileName {
    public:
+2 −2
Original line number Diff line number Diff line
@@ -11,12 +11,12 @@ TEST(FileList, NonExistantFileConstructor)
  }
  catch(Isis::IException &e)
  {
    EXPECT_TRUE(e.toString().toLatin1().contains("Unable to open [FakeFile]."))
    EXPECT_TRUE(e.toString().toLatin1().contains("Unable to open [FakeFile]"))
      << e.toString().toStdString();
  }
  catch(...)
  {
    FAIL() << "Expected an IException\"Unable to open [FakeFile].\"";
    FAIL() << "Expected an IException\"Unable to open [FakeFile]\"";
  }
}