Files
cal.diy/packages/lib
Yash SinghandBandhan Majumder 1599dfd515 fix: zero-pad username suggestion suffix consistently (#29571)
generateUsernameSuggestion built its numeric suffix with
String(rand).padStart(4 - rand.toString().length, "0"). padStart's first
argument is the target total length, not the number of pad characters, so the
expression only padded single-digit numbers: rand=1 became "001" but rand=42
became "42" and rand=999 stayed "999". Suggested usernames therefore had
inconsistent suffix widths, and the magic 4 didn't match the 3-wide output the
existing test pins ("johnny001").

Pull the suffix into a small helper that always pads to 3 digits, so collisions
and the returned value share one definition and every suggestion is uniformly
zero-padded. Add unit tests for the first-attempt path and for two- and
three-digit suffixes; the two-digit case fails on the old code.

Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
2026-06-19 05:37:42 +00:00
..
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-01-02 12:47:00 +00:00
2024-04-27 18:14:37 +02:00
2026-04-15 09:52:36 -03:00
2025-03-20 21:30:51 -03:00
2024-03-08 15:13:29 +00:00
2025-11-28 09:14:48 +00:00
2025-11-26 17:02:42 +01:00
2026-01-02 12:47:00 +00:00
2024-10-04 13:44:50 -07:00
2024-05-10 08:47:57 +01:00
2025-12-16 14:01:54 +00:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2026-04-15 09:52:36 -03:00
2025-08-31 08:20:19 +00:00