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

Allow timeinput without ':' #5129

Open
Jonas-Marty opened this issue May 6, 2024 · 3 comments
Open

Allow timeinput without ':' #5129

Jonas-Marty opened this issue May 6, 2024 · 3 comments
Labels
External feedback This Issue is Based on Feedback from the Community

Comments

@Jonas-Marty
Copy link

Block times must be entered by explicitly enter 7:00 or 07:00.

I'd like to enter times similar to https://sbb.ch, there I can enter different formats that get auto formatted:
700 = 7:00
7.00 = 7:00
0700 = 07:00
7 = 7:00
07 : 7:00

Time input may depend on culture - this feature is therefore possibly specific to (swiss-) german input culture.
As I guess Ecamp is currently only used in Switzerland this feature can be limited to be working with this culture and ignored for others.

@manuelmeister manuelmeister added the External feedback This Issue is Based on Feedback from the Community label May 6, 2024
@manuelmeister
Copy link
Member

Interesting. What time would you expect with the following inputs:

1, 5, 9, 01, 18, 23, 25, 27, 42, 84, 99, 010, 023, 145, 147, 189, 191, 203, 214, 240

I tried different methods:

  • A: Parse number as hours
  • B1: Split in the middle, expect the user to omit the last digit (124X => 12:40) max time
  • B2: Split in the middle, expect the user to omit the middle digit (12X4 => 12:04) min time
  • C: Parse number as minutes, if value has 3 digits, split off first digit and use as hour (X124 => 01:24)
  • Best effort: try to parse numbers as forgiving as possible, using the other methods in order: A > B1 > B2 > C
Input A B1 B2 C Best effort
1 01:00 00:10 00:01 00:01 01:00
5 05:00 00:50 00:05 00:05 05:00
9 09:00 err 00:09 00:09 09:00
01 01:00 00:10 00:01 00:01 01:00
18 18:00 err 01:08 00:18 18:00
23 23:00 02:30 02:03 00:23 23:00
25 err 02:50 02:05 00:25 02:50
27 err err 02:07 00:27 02:07
42 err 04:20 004:02 00:42 04:20
84 err 08:40 08:04 err 08:40
99 err err 09:09 err 09:09
010 err 01:00 01:00 00:10 01:00
023 err 02:30 02:03 00:23 02:30
145 err 14:50 14:05 01:45 14:50
147 err err 14:07 01:47 14:07
189 err err 18:09 err 18:09
191 err 19:10 19:01 err 19:10
203 err 20:30 20:03 02:03 20:30
214 err 21:40 21:04 02:14 21:40
240 err err err 02:40 21:40
269 err err err err err
313 err err err 03:13 03:13
999 err err err err err

The challenges generally are with numbers greater than 23
For numbers greater than 239, method C is the only valid one, except for cases where the number ends with digits higher than 59. In these cases we have to throw an error.
In the other cases we may still want to throw an error as I don't think user want/understand method B2.

The best effort method assumes that people may have paused writing and will add the last digit, therefore our guess is already close (maybe off by max. 9 minutes for 3 digit numbers). Also they probably care less for minutes than for hours or ten minutes increments.

This method prioritizes the afternoon instead of the nighttime: 145 => 14:50 instead of 01:45.
I think this assumption maybe the most bold of all, and could be redefined to just use the method C in those cases as well. It has the advantage that it can still parse 160 <= value < 200.

@manuelmeister manuelmeister added the Meeting Discuss Am nächsten Core-Meeting besprechen label Jul 7, 2024
@manuelmeister
Copy link
Member

Core Meeting Decision

Implement as in https://angular.app.sbb.ch/angular/components/time-input/overview
In a next iteration, we may improve the mechanism again.

@manuelmeister manuelmeister removed the Meeting Discuss Am nächsten Core-Meeting besprechen label Jul 9, 2024
@Jonas-Marty
Copy link
Author

Thanks for implementing this QoL feature, will save me some nerves and let's me enjoy Ecamp3 more🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External feedback This Issue is Based on Feedback from the Community
Projects
None yet
Development

No branches or pull requests

2 participants