Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzzy_time segment prints "o'clock three" instead of "three o'clock" #2257

Closed
doctor-jan opened this issue May 9, 2024 · 2 comments
Closed

Comments

@doctor-jan
Copy link

When using the fuzzy_time option in the time.py segment, at the top of each hour we see, for example,
o'clock three
instead of
three o'clock

All other times are in the format 'x to three' or 'x past three'. So extra code is needed to detect the 0 minutes times and swap the components around.

@PH111P PH111P closed this as completed in 6b36ba8 May 11, 2024
@PH111P
Copy link
Member

PH111P commented May 11, 2024

Hi @doctor-jan,

Thanks for your report. Indeed, that looks like a bug. There was actually even another bug with the string used for "half-past": x:31 and x:30 were printed as "half past x+1". (With such bugs being unnoticed for this long, I am seriously wondering if anyone is actually using this segment.)

The fix is a little bit different than what you suggested:

  • The format argument is now unused.
  • Instead, each minute_str now is used as a format string and has an '{hour_str}' field to specify where the hour should be placed.

@doctor-jan
Copy link
Author

Thanks for your super-speedy fix :-)

This is a much better solution, and it looks like the code is now a bit less complex.

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

No branches or pull requests

2 participants