Skip to content

Conversation

@DylanDevelops
Copy link
Owner

Introduces user-configurable date formats for manual and edit time entry commands by loading the global config and adjusting prompts, validation, and parsing accordingly. Updates validation and parsing functions to accept date format parameters, and adds a helper to map config values to display and Go layouts. Updates tests to use the new function signatures.

Pull Request Checklist

  • I have read and followed the contribution guidelines.
  • My pull request targets the main branch of tmpo.
  • I have tested these changes locally on my machine.

Description

This pull request updates the time entry commands to support user-configurable date formats throughout the manual and edit workflows. The changes ensure that date prompts, validation, and parsing all respect the user's preferred date format as set in their global configuration. This improves usability for users in different locales and prevents date format confusion. Additionally, the test suite is updated to reflect the new function signatures.

User-configurable date format support:

  • Added a getDateFormatInfo helper function to map user-configured date formats to display strings and Go time layouts. This is used to dynamically set prompt labels and parsing formats. (cmd/entries/manual.go cmd/entries/manual.goL9-R34)
  • Both the manual and edit commands now load the user's preferred date format from the global config and use it for all date prompts, validation, and parsing. (cmd/entries/manual.go [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Validation and parsing improvements:

  • Updated validateDate, validateDateOptional, validateEndDateTime, and parseDateTime to accept a date layout and display format, ensuring all validation and parsing logic is format-aware. (cmd/entries/manual.go [1] [2] [3] cmd/entries/edit.go [4]

Test updates:

  • Updated tests for date validation, end date/time validation, and date/time parsing to use the new function signatures with explicit date layouts. (cmd/entries/manual_test.go [1] [2] [3]

DylanDevelops and others added 3 commits December 28, 2025 11:30
Introduces user-configurable date formats for manual and edit time entry commands by loading the global config and adjusting prompts, validation, and parsing accordingly. Updates validation and parsing functions to accept date format parameters, and adds a helper to map config values to display and Go layouts. Updates tests to use the new function signatures.
Updated documentation to clarify that the configured date format affects both display and input prompts throughout tmpo. Added notes and examples to help users understand how date input adapts to their configuration in manual entry and edit flows.
@DylanDevelops DylanDevelops merged commit 78ba856 into main Dec 28, 2025
6 checks passed
@DylanDevelops DylanDevelops deleted the ravel/improved-global-config-usage branch December 28, 2025 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants