Add option to trim leading zeros in hours description#379
Merged
bradymholt merged 4 commits intobradymholt:mainfrom Mar 18, 2026
Merged
Conversation
Signed-off-by: AFONSO PIMENTA <afonsocpimenta04@gmail.com>
Signed-off-by: AFONSO PIMENTA <afonsocpimenta04@gmail.com>
Signed-off-by: AFONSO PIMENTA <afonsocpimenta04@gmail.com>
bc4305e to
d8e4b01
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new formatting option to control whether hour values are zero-padded in generated time strings, addressing reported issues where 12-hour clock output included a leading zero.
Changes:
- Introduces a new
trimHoursLeadingZerooption on the publicOptionsinterface. - Updates
ExpressionDescriptor.formatTimeto optionally render hours without zero-padding. - Updates documentation and adds/adjusts tests (including a Chai import update for Node >20 compatibility).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/i18n.ts | Updates Chai import style to align with other tests / Node >20 compatibility. |
| test/cronstrue.ts | Adds test cases validating trimHoursLeadingZero behavior in both 12h and 24h modes. |
| src/options.ts | Exposes the new trimHoursLeadingZero option in the public Options interface. |
| src/expressionDescriptor.ts | Implements the new option in time formatting output. |
| README.md | Documents the new option and its default/behavior. |
💡 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
|
Thanks! |
|
The changes in this PR were just released in v3.14.0 🎉. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new
trimHoursLeadingZerooption. Addresses #254 and #217As discussed in #254 (comment), I agree with you and think creating a new option and exposing it to the user is more transparent and consistent than enforcing a specific style
Also updated
import chai = require("chai");oni18n.tsto newest syntax to support running tests on node >20