Skip to content

Conversation

@JerryZhouCMU
Copy link

Initial implementation of ZonedDateTime Module

File Organization

This PR has added function implementations based on #6389

Function implementation:

  • ZonedDateTime.dfy
  • ZonedDateTimeImpl.cs

Test and Example code:

  • ZonedDateTimeExamples.dfy

Updated Documentation:

  • DateTime.md

Declaration about the logic in ZonedDateTime

Hi, Robin @robin-aws. Zoned Date Time now only has DST handling in Of() function as the user will specify the zone id in the parameter. Arithmetic functions (Plus*() & Minus*()) and With*() functions don't have DST handling as these functions are offset-based and we don't ask users to specify zone id in these functions.

Issues about tests in ZonedDateTimeExamples

Some test functions such as TestFormatISO8601() had Verification out of resource error displayed on IDE before adding {:resource_limit 5000000} at the function head. However, when executing Test Commands all the tests passed even without specifying the resource limit.

We need to see if this result is acceptable. If it is, we will keep this implementation in this version.

The test case that has Verification out of resource error displayed on IDE before specifying the resource limit:

method {:test} {:resource_limit 5000000} TestFormatISO8601()
{
    var ldt := LDT.LocalDateTime(2023, 6, 15, 14, 30, 45, 123);
    var zdt := ZDT.ZonedDateTime(ldt, "Asia/Shanghai", 480);
    var isoFormat := ZDT.Format(zdt, ZDT.DateFormat.ISO8601);
    AssertAndExpect(isoFormat == "2023-06-15T14:30:45.123+08:00");
}

flowKKo and others added 30 commits October 28, 2025 14:44
…move file description content from md to corresponding files
@JerryZhouCMU
Copy link
Author

@robin-aws Hi Robin, I found that I couldn't edit the whole PR to show only the diff between local-datetime-duration and zoned-date-time since this PR is asking to be merged into master branch. However, I squashed all my commits into one:
583689b#diff-3e4cb772c6746587b97d2a3606223d19370443d44a1c54e37b593ba57b800264
Here you can see the commit that shows all the differences between local-datetime-duration and zoned-date-time in this PR. If you have a better option to edit the PR, please feel free to share. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants