Skip to content

feat: added chrono utility#69

Merged
ElhamAryanpur merged 10 commits into
mainfrom
chrono
Jun 23, 2025
Merged

feat: added chrono utility#69
ElhamAryanpur merged 10 commits into
mainfrom
chrono

Conversation

@khushmmehta
Copy link
Copy Markdown
Contributor

@khushmmehta khushmmehta commented Jun 19, 2025

Introduced a LuaDateTime struct which wraps a chrono::DateTime<FixedOffset>struct for use with lua. Generated a table for it with 4 constructors, for current and custom UTC/Local timezones.

Get and set data in a DateTime struct with similar methods to the JavaScript Date Reference

Bumped chrono dependency from 0.4.40 to 0.4.41

Refs: #16

Comment thread src/components/chrono.rs Outdated
All error handling in `chrono.rs` was changed from `.expect` to
exhaustive match cases, delegating the errors to lua.

Refs: #69 #16
The `year` field is the only required field in the construction Of
LuaDateTime structs. Other fields are now optional.

Refs: #69 #16
Added the appropriate prefix to the constructor functions.

Renamed the `get_date()` function to `get_day()`. Changed all arguments
named date to day.
Renamed `get_epoch_millis()` to `get_epoch_milliseconds()`

Refs: #69 #16
Comment thread src/lua/astra.lua Outdated
Comment thread src/components/chrono.rs Outdated
Removed the lua table for the datetime constructor functions, simply
setting them as globals instead.

Refs: #69 #16
@ElhamAryanpur ElhamAryanpur added the enhancement New feature or request label Jun 22, 2025
@ElhamAryanpur ElhamAryanpur added this to the v1.0 milestone Jun 22, 2025
@ElhamAryanpur ElhamAryanpur linked an issue Jun 22, 2025 that may be closed by this pull request
@ElhamAryanpur
Copy link
Copy Markdown
Member

Looks good to me, good job!

Final step is documentation for it. look into src/docs/latest and add an entry for chrono. More info on how to work with docs with mdbook: https://rust-lang.github.io/mdBook/

After that this PR will be merged and v0.23.0 will be released!

@ElhamAryanpur
Copy link
Copy Markdown
Member

I have simplified the docs a bit, should be all set now.

Congratulations on the first contribution release!

@ElhamAryanpur ElhamAryanpur merged commit fac66d6 into main Jun 23, 2025
@ElhamAryanpur ElhamAryanpur deleted the chrono branch June 23, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chrono utility

2 participants