steve icon indicating copy to clipboard operation
steve copied to clipboard

switch from joda.time to java.time

Open juherr opened this issue 8 months ago • 5 comments

Close #98

juherr avatar Apr 02 '25 16:04 juherr

Depends on https://github.com/steve-community/ocpp-jaxb/pull/16

juherr avatar Apr 02 '25 16:04 juherr

i considered this years ago but then dismissed the topic, because of the following...

joda's DateTime is forgiving if the timezone designator is missing. timezone designator is a MUST for java's data types. you can imagine joda's DateTime as a union of multiple possible date-time types in java.time package. since some weird charging station implementations do NOT send timezone, i decided to stay with joda's DateTime back then. sad but true. otherwise, we would break compatibility.

goekay avatar Apr 03 '25 07:04 goekay

test code:

    public static void main(String[] args) {
        // this will work fine for both
        {
            String s = "2025-04-03T09:30:00.00000+02:00";

            DateTime dt1 = DateTime.parse(s);
            System.out.println(dt1);

            OffsetDateTime dt2 = OffsetDateTime.parse(s);
            System.out.println(dt2);
        }

        // this will explode in case of OffsetDateTime
        {
            String s = "2025-04-03T09:30:00";

            DateTime dt1 = DateTime.parse(s);
            System.out.println(dt1);

            OffsetDateTime dt2 = OffsetDateTime.parse(s);
            System.out.println(dt2);
        }
    }

goekay avatar Apr 03 '25 07:04 goekay

You are right, but the issue doesn't exist because already treated. See https://github.com/steve-community/ocpp-jaxb/pull/16/files#r2026501536

juherr avatar Apr 03 '25 08:04 juherr

Neat! Let's continue the conversation there.

goekay avatar Apr 06 '25 08:04 goekay

Closing this PR due to inactivity. Feel free to reopen if needed. See: https://github.com/juherr/evolve/pull/1

juherr avatar Jul 27 '25 21:07 juherr