feat: implementation of the stdlib_datetime module#1148
feat: implementation of the stdlib_datetime module#1148JAi-SATHVIK wants to merge 13 commits intofortran-lang:masterfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1148 +/- ##
==========================================
+ Coverage 68.00% 68.64% +0.64%
==========================================
Files 403 407 +4
Lines 12850 13613 +763
Branches 1383 1536 +153
==========================================
+ Hits 8738 9345 +607
- Misses 4112 4268 +156 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Implements an experimental stdlib_datetime module, along with build integration, documentation, examples, and a new test suite to validate date/time arithmetic, parsing/formatting, and calendar utilities.
Changes:
- Added
src/datetime/stdlib_datetime.f90providingdatetime_type/timedelta_type, arithmetic/comparison operators, ISO8601 parsing/formatting, and helper utilities. - Integrated the datetime component into the library build and added a datetime test target and example program.
- Added a new spec document describing the module API and supported behaviors.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
src/datetime/stdlib_datetime.f90 |
New datetime/timedelta types, operators, ISO parsing/formatting, and calendar utilities. |
src/datetime/CMakeLists.txt |
Adds the datetime library target and links it to core. |
src/CMakeLists.txt |
Adds datetime subdirectory and links it into the top-level stdlib target. |
test/datetime/test_datetime.f90 |
New unit tests for leap years, parsing/formatting, arithmetic, comparisons, and rollovers. |
test/datetime/CMakeLists.txt |
Registers datetime as a test target. |
test/CMakeLists.txt |
Adds datetime tests to the test build. |
example/datetime/example_datetime_usage.f90 |
New usage example demonstrating common API calls. |
example/datetime/CMakeLists.txt |
Registers datetime example target. |
example/CMakeLists.txt |
Adds datetime examples to the example build. |
doc/specs/stdlib_datetime.md |
New specification page describing the module API and formats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
Hi @jalvesz, I have a few questions regarding the module implementation. Could you please walk me through them? Should timestamps without a designator |
|
Hi @jalvesz Just checking in to see if there's any additional information I can provide to help with the review process. Happy to make any necessary adjustments! |
jvdp1
left a comment
There was a problem hiding this comment.
Thank you @JAi-SATHVIK for this PR. A very complete set of procedures to handle dates an times IMO.
src/datetime/stdlib_datetime.f90
Outdated
| str = buf(1:n) | ||
| end function format_datetime | ||
|
|
||
| function format_timedelta(td) result(str) |
There was a problem hiding this comment.
This procedure cannot be PURE because the Fortran standard prohibits the use of internal WRITE statements within pure subprograms.
There was a problem hiding this comment.
Internal write are allowed in pure procedures.
See an example here:
Or does I miss something?
There was a problem hiding this comment.
my mistake! I've updated both format_datetime and format_timedelta to be pure. Thanks for the correction and the reference.
#1147