Skip to content

OffsetDateTimeCodec does not properly decode negative timezone offsets #208

Closed
@italiviocorrea

Description

@italiviocorrea

Bug Report

I'm using the latest driver 0.8.6.

I have a field in an MSSQLServer table that is of the DateTimeOffSet type, and I realized that when the timezone is negative it ignores the signal and treats it as a positive timezone.
Analyzing the code of the OffsetDateTimeCodec Class, in line 87 we have a call to the uShort method of the Decode class, which converts the buffer to an unsigned integer.

     int localMinutesOffset = Decode.uShort (buffer);

This removes the TimeZone signal when it is negative. The correct thing would be to do this:

     int localMinutesOffset = Decode.Short (buffer);

As the Short method does not exist in the Decode class, it would be necessary to add it to this class, as in the example below:

 public static int Short (ByteBuf buffer) {
     return buffer.readShortLE ();
 }

With this simple change, the negative and positive timezones will be decoded correctly.

Activity

mp911de

mp911de commented on Jul 19, 2021

@mp911de
Member

Are you interested in providing a pull request that contains the fix and a way to reproduce the issue?

italiviocorrea

italiviocorrea commented on Jul 19, 2021

@italiviocorrea
Author

Hey! I can make the correction yes, it's up to you. Even because I made a fork and I'm using it with the fix, so far this solution is ok. I'm not practice pull request, but I'm a fast learner and I have a lot of experience in java programming, suddenly I can help fix other bugs. And I'm already using the lib in one project, which I'm currently working on, and I plan to use it in other projects.

changed the title [-]Problem with negative Timezone in column of type DateTimeZoneOffSet[/-] [+]`OffsetDateTimeCodec` does not properly decode negative timezone offsets[/+] on Aug 11, 2021
added this to the 0.8.7.RELEASE milestone on Aug 11, 2021
added a commit that references this issue on Aug 11, 2021
f809359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mp911de@italiviocorrea

        Issue actions

          `OffsetDateTimeCodec` does not properly decode negative timezone offsets · Issue #208 · r2dbc/r2dbc-mssql