legacy icon indicating copy to clipboard operation
legacy copied to clipboard

`Date.date` incorrectly modifies local time with timezone offset

Open Skyb0rg007 opened this issue 11 months ago • 1 comments

Version

110.99.4 (Latest)

Operating System

  • [X] Any
  • [ ] Linux
  • [ ] macOS
  • [ ] Windows
  • [ ] Other Unix

OS Version

No response

Processor

  • [X] Any
  • [ ] Arm (using Rosetta)
  • [ ] PowerPC
  • [ ] Sparc
  • [ ] x86 (32-bit)
  • [ ] x86-64 (64-bit)
  • [ ] Other

System Component

Basis Library

Severity

Minor

Description

Date.date is meant to build a Date.date from a specification. However it does not properly handle a provided timezone offset, and seems to be adding it to the date and time themselves.

Transcript

- val d = Date.date {year=2024, month=Date.Mar, day=14, hour=12, minute=30, second=0, offset = SOME (Time.fromSeconds 60)};
- Date.minute d;
val it = 31 : int

Expected Behavior

- val d = Date.date {year=2024, month=Date.Mar, day=14, hour=12, minute=30, second=0, offset = SOME (Time.fromSeconds 60)};
- Date.minute d;
val it = 30 : int

Namely, the local date and time should be preserved independently from the timezone offset

Steps to Reproduce

See transcript

Additional Information

This is implemented correctly in MLton and Poly/ML

Email address

[email protected]

Skyb0rg007 avatar Mar 14 '24 17:03 Skyb0rg007