smlnj / legacy

This project is the old version of Standard ML of New Jersey that continues to support older systems (e.g., 32-bit machines).
BSD 3-Clause "New" or "Revised" License
25 stars 10 forks source link

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

Open Skyb0rg007 opened 3 months ago

Skyb0rg007 commented 3 months ago

Version

110.99.4 (Latest)

Operating System

OS Version

No response

Processor

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

skyler.soss@gmail.com

JohnReppy commented 3 months ago

Cross referenced in development branch as Issue 285