Add weekday() and current_time() functions #71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description ✍️
This PR adds 2 new functions to parsec, weekday and current_time.
weekday()
weekday will calculate the weekday based on a date or datetime, and will return an integer if no locale is passed or a string with the translated weekday name if a locale is passed
current_time()
current_time will return the current_time in gmt. If the (optional) integer argument is passed, it'll return the current_time considering the argument as an offset.
Examples
'weekday("2024-12-05")' will return 4, and 'weekday("2021-03-21", "pt-BR")' will return 'Quinta-Feira'
At the time of writing:
current_time() will return 19:09:13 and current_time(-3) 16:09:13 (GMT -3 is brasil time)
Overview 🔍
Overview of the feature if possible (screenshot, gif, etc)
Checks ☑️