From 20c9366bcfd92b9ff32cb44667c86451cd4c6a83 Mon Sep 17 00:00:00 2001 From: Hamish Brown Date: Wed, 22 May 2024 08:49:11 +1200 Subject: [PATCH] Adding condition so date parsing is done correctly on local and github platforms --- TestComponents/Test.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TestComponents/Test.cs b/TestComponents/Test.cs index 64853bb..2378a7a 100644 --- a/TestComponents/Test.cs +++ b/TestComponents/Test.cs @@ -280,8 +280,17 @@ private static int getTestRow(string test, DataFrame allTests) if (row[0].ToString() == test) //if this date row holds data for current site { - DateTime date = DateTime.ParseExact(row[1].ToString(), "d/MM/yyyy", CultureInfo.InvariantCulture); - //DateTime date = (DateTime)row[1]; + DateTime date = new DateTime(); + if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) + { + //Need to parse date like this in GitHub + date = DateTime.ParseExact(row[1].ToString(), "d/MM/yyyy", CultureInfo.InvariantCulture); + } + else + { + //And need to do it like this locally + date = (DateTime)row[1]; + } DateTime last = new DateTime(); if (fert.Keys.Count > 0)