Skip to content

Conversation

@SteveEdson
Copy link
Contributor

@SteveEdson SteveEdson commented Jan 7, 2026

Description

Problem

When entering time in HH:MM format (e.g., 4:30 for 4 hours 30 minutes), the form was incorrectly sending only 4 hours to FreeAgent. This was because parseFloat("4:30") stops parsing at the colon and returns 4.

Solution

Added a parseHours function that properly handles both time formats:

  • HH:MM format: 4:30 → 4.5 hours (converts minutes to decimal)
  • Decimal format: 4.5 → 4.5 hours

Invalid inputs (negative values, minutes ≥ 60, non-numeric strings) now show a validation error instead of silently failing.

Changes

  • Added parseHours() function with proper validation
  • Updated form submission to validate hours before sending
  • Added info tooltip to the hours field explaining supported formats
  • Updated placeholder text to show example formats

Screencast

Checklist

- Merge branch \'contributions/merge-1767780738708\'
- Pull contributions
- Add flexible hours input parsing to timeslip form
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: freeagent Issues related to the freeagent extension platform: macOS platform: Windows OP is author The OP of the PR is the author of the extension labels Jan 7, 2026
@raycastbot
Copy link
Collaborator

Thank you for the update! 🎉

Due to our current reduced availability, the initial review may take up to 10-15 business days.

@SteveEdson SteveEdson marked this pull request as ready for review January 7, 2026 10:15
Copilot AI review requested due to automatic review settings January 7, 2026 10:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the FreeAgent extension where time entries in HH:MM format (e.g., "4:30") were incorrectly parsed, sending only the hours portion to the API. The fix introduces proper time parsing logic that handles both HH:MM and decimal formats, with validation to prevent invalid inputs.

Key Changes:

  • Added parseHours() function to correctly convert both HH:MM and decimal time formats
  • Enhanced form validation to catch and display errors for invalid time inputs
  • Improved user guidance with updated placeholder text and informational tooltip

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
extensions/freeagent/src/create-timeslip.tsx Added parseHours function with validation logic and updated form submission to use it
extensions/freeagent/CHANGELOG.md Documented the bug fix and new time format support

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile Summary

Fixed a bug where entering time in HH:MM format (e.g., 4:30) would only record the hours portion because parseFloat() stops parsing at non-numeric characters.

  • Added parseHours() function that properly converts HH:MM format to decimal hours (e.g., 4:30 → 4.5)
  • Supports both decimal format (4.5) and time format (4:30)
  • Validates input and shows user-friendly error messages for invalid formats
  • Updated form field with helpful placeholder and info tooltip explaining supported formats
  • Changelog follows proper formatting with {PR_MERGE_DATE} placeholder at the top

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The implementation is thorough with proper edge case handling (empty input, negative values, invalid formats, minutes >= 60, multiple colons). The parseHours function is well-tested logic that correctly handles both time formats. The change is backward compatible (decimal format still works) and adds validation that was missing. Changelog follows repository standards.
  • No files require special attention

Important Files Changed

Filename Overview
extensions/freeagent/src/create-timeslip.tsx Added parseHours() utility to properly handle HH:MM and decimal time formats with comprehensive validation
extensions/freeagent/CHANGELOG.md Added changelog entry for time parsing fix with proper formatting and {PR_MERGE_DATE} placeholder

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit c35e89e into raycast:main Jan 8, 2026
2 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Published to the Raycast Store:
https://raycast.com/SteveEdson/freeagent

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Published to the Raycast Store:
https://raycast.com/SteveEdson/freeagent

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: freeagent Issues related to the freeagent extension OP is author The OP of the PR is the author of the extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants