Closed bmml1 closed 1 year ago
Gutentag! Yes the issue was the time variable couldn't be converted if DD was a single digit. Meaning if you ran it on the 1st through to the 9th of the month it would crap out. This breaks the update checker. Pretty annoying and not something I tested for before releasing.
Fix is to either manually update to latest version or open stats.csv and delete the value for LastUpdateCheck. Also covered off here: https://github.com/shupershuff/Diablo2RLoader/issues/15
I'll put a note on the readme page too.
Hello,
thanks for the quick response. I still have the issue with 1.83
What happens if you test the part from screenshot 2 in your powershell console?
BR
These two variants would work on my machine. Maybe you can try on yours too. Edit: it breaks the if clause somehow..
[datetime]::ParseExact('3/6/2000 12:00:00 PM','d/M/yyyy h:mm:ss tt', [cultureinfo]::InvariantCulture)
Samstag, 3. Juni 2000 12:00:00
[datetime]::ParseExact('03/06/2000 12:00:00 PM','d/M/yyyy h:mm:ss tt', [cultureinfo]::InvariantCulture)
Samstag, 3. Juni 2000 12:00:00
Edit2: Maybe it is possible to save the date in another format something like:
(Get-Date -Year 2000 -Month 12 -Day 31).ToUniversalTime().ToString('yyyyMMddTHHmmss')
20001231T195700
and compare it with
(Get-Date).addHours(-8).ToUniversalTime().ToString('yyyyMMddTHHmmss')
20230831T105811
Hello,
thanks for the quick response. I still have the issue with 1.83
What happens if you test the part from screenshot 2 in your powershell console?
BR
I tried the below which worked fine for me:
$s = "28/06/2000 12:00:00 pm"
[DateTime]::ParseExact($s, "dd/MM/yyyy h:mm:ss tt", $null);
I suspect the issue is with having different region settings. What do your date settings look like? Mine look like this. I might use your suggestion with Universal time.
@bmml1 Can you test this for me:
$s = [Datetime]"28/06/2000 12:00:00 pm"
[DateTime]::ParseExact($s, "dd/MM/yyyy h:mm:ss tt", $null);
Does not work, most likely because of locale settings.
PS C:\Users\xx> $s = [Datetime]"28/06/2000 12:00:00 pm"
Der Wert "28/06/2000 12:00:00 pm" kann nicht in den Typ "System.DateTime" konvertiert werden. Fehler: "Die
Zeichenfolge wurde nicht als gültiges DateTime erkannt."
In Zeile:1 Zeichen:1
+ $s = [Datetime]"28/06/2000 12:00:00 pm"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastParseTargetInvocationWithFormatProvider
Here are mine:
Thanks, I'll try and update the script tonight to use a universal time format.
I've done a slightly different approach, this time specifying how to read the data as well as how to output it. Can please ask you to test this for me before I release this? Please test by downloading the updated PS1 file and copy over your existing one. You won't have to edit stats.csv. https://github.com/shupershuff/Diablo2RLoader/blob/main/D2Loader.ps1
Works like a charm. Thx :)
Ha I was just looking at this as I was still getting an error. I thought I'd try to fix it myself. Tried to push and saw you fixed it too! I did it really similarly
$CurrentStats.LastUpdateCheck = get-date -Format "dd/MM/yyyy hh:mm:ss"
removed the pm
where it's written.
I made a couple other slight changes prior to release but it's functionally the same. Thanks for raising this and thanks for your input.
@bmml1 have you had any issues the hours played display showing incorrectly? Wondering if there's another regional issue.
Just had another German based person note that the display shows incorrectly (possibly minutes showing as hours):
It should look like this
Yep, looks like in the first picture.
I've drafted a small update to resolve that issue. If you like you can test it: https://github.com/shupershuff/Diablo2RLoader/blob/main/D2Loader.ps1
Now it looks like in picture 2. thx
Hello,
the if clause in line 199 throws an exception which might have something to do with locales. I am using Windows 11 with german system locale. Script continues just fine, but the auto update column in stats does not get updated in the stats.csv due to the exception.
It says something like "the string is not a valid datetime"
To reproduce I did this:
Cheers!