Code Monkey home page Code Monkey logo

Comments (15)

bmml1 avatar bmml1 commented on September 28, 2024 1

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:
grafik

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024 1

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

from diablo2rloader.

never147 avatar never147 commented on September 28, 2024 1

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.

from diablo2rloader.

bmml1 avatar bmml1 commented on September 28, 2024 1

Now it looks like in picture 2. thx

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

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: #15

I'll put a note on the readme page too.

from diablo2rloader.

bmml1 avatar bmml1 commented on September 28, 2024

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

from diablo2rloader.

bmml1 avatar bmml1 commented on September 28, 2024

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

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

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);

image

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.
image

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

@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);

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

Thanks, I'll try and update the script tonight to use a universal time format.

from diablo2rloader.

bmml1 avatar bmml1 commented on September 28, 2024

Works like a charm. Thx :)

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

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.

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

@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):
image

It should look like this
image

from diablo2rloader.

bmml1 avatar bmml1 commented on September 28, 2024

Yep, looks like in the first picture.

from diablo2rloader.

shupershuff avatar shupershuff commented on September 28, 2024

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

from diablo2rloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.