Conversation
Co-authored-by: markets <576701+markets@users.noreply.github.com>
Co-authored-by: markets <576701+markets@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] add new "hash" style, which returns structured hash data, ie: { years: 1, months: 2}
Add new "hash" style that returns structured hash data
Aug 11, 2025
Owner
|
@copilot Not bad, but:
|
Co-authored-by: markets <576701+markets@users.noreply.github.com>
Contributor
Author
Implemented both requested changes in commit 05a2c5b: Localized hash keys: Hash style now returns keys in the target language: timeago('2020-1-1', '2021-3-15', style: :hash, locale: :es)
# => {:años=>1, :meses=>2}Refactored to reuse existing methods: Removed the duplicate The hash style now works seamlessly with all existing options (depth, threshold, only) and provides localized keys for all supported languages. |
Copilot
AI
changed the title
Add new "hash" style that returns structured hash data
Add localized hash style that returns structured data with locale-specific keys
Aug 11, 2025
markets
reviewed
Aug 11, 2025
…tion Co-authored-by: markets <576701+markets@users.noreply.github.com>
markets
reviewed
Aug 11, 2025
…Y code Co-authored-by: markets <576701+markets@users.noreply.github.com>
hash style that returns structured data with locale-specific keys
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.
This PR implements a new "hash" style option that returns structured hash data with localized keys, addressing the feature request to provide programmatic access to time components while maintaining locale support.
What's Changed
The
:hashstyle now returns time components as a hash with localized symbolic keys and numeric values:Key Features
depth,threshold, andonly["today"],["yesterday"],["tomorrow"]{días: 0}for today,{días: 1}for yesterday/tomorrow (localized)--style hashoption and locale supportExamples
CLI Usage
This enhancement enables developers to easily access individual time components for calculations, formatting, or data processing with full internationalization support, eliminating the need to parse formatted strings.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.