Skip to content

DayValue gives incorrect results when run in non-UTC environment #23

@56quarters

Description

@56quarters

When running unit tests locally for DayValue, they fail and appear to be off by one day.

--- FAIL: TestDayValueYAML (0.00s)
    day_test.go:25: 
                Error Trace:    day_test.go:25
                Error:          Not equal: 
                                expected: []byte{0x64, 0x61, 0x79, 0x3a, 0x20, 0x22, 0x31, 0x39, 0x38, 0x35, 0x2d, 0x30, 0x36, 0x2d, 0x30, 0x32, 0x22, 0xa}
                                actual  : []byte{0x64, 0x61, 0x79, 0x3a, 0x20, 0x22, 0x31, 0x39, 0x38, 0x35, 0x2d, 0x30, 0x36, 0x2d, 0x30, 0x31, 0x22, 0xa}
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,3 +1,3 @@
                                 ([]uint8) (len=18) {
                                - 00000000  64 61 79 3a 20 22 31 39  38 35 2d 30 36 2d 30 32  |day: "1985-06-02|
                                + 00000000  64 61 79 3a 20 22 31 39  38 35 2d 30 36 2d 30 31  |day: "1985-06-01|
                                  00000010  22 0a                                             |".|
                Test:           TestDayValueYAML
    day_test.go:47: 
                Error Trace:    day_test.go:47
                Error:          Not equal: 
                                expected: []byte{0x64, 0x61, 0x79, 0x3a, 0x20, 0x22, 0x31, 0x39, 0x38, 0x35, 0x2d, 0x30, 0x36, 0x2d, 0x30, 0x32, 0x22, 0xa}
                                actual  : []byte{0x64, 0x61, 0x79, 0x3a, 0x20, 0x22, 0x31, 0x39, 0x38, 0x35, 0x2d, 0x30, 0x36, 0x2d, 0x30, 0x31, 0x22, 0xa}
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,3 +1,3 @@
                                 ([]uint8) (len=18) {
                                - 00000000  64 61 79 3a 20 22 31 39  38 35 2d 30 36 2d 30 32  |day: "1985-06-02|
                                + 00000000  64 61 79 3a 20 22 31 39  38 35 2d 30 36 2d 30 31  |day: "1985-06-01|
                                  00000010  22 0a                                             |".|
                Test:           TestDayValueYAML

Local machine:

$ timedatectl 
               Local time: Wed 2021-08-25 19:21:47 EDT
           Universal time: Wed 2021-08-25 23:21:47 UTC
                 RTC time: Wed 2021-08-25 23:21:47
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions