Skip to content

Commit

Permalink
Adding condition so date parsing is done correctly on local and githu…
Browse files Browse the repository at this point in the history
…b platforms
  • Loading branch information
HamishBrownPFR committed May 21, 2024
1 parent 8c55315 commit 20c9366
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions TestComponents/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 287 in TestComponents/Test.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 's' in 'DateTime DateTime.ParseExact(string s, string format, IFormatProvider? provider)'.

Check warning on line 287 in TestComponents/Test.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 's' in 'DateTime DateTime.ParseExact(string s, string format, IFormatProvider? provider)'.
}
else
{
//And need to do it like this locally
date = (DateTime)row[1];
}

DateTime last = new DateTime();
if (fert.Keys.Count > 0)
Expand Down

0 comments on commit 20c9366

Please sign in to comment.