Commit a5fb4da
authored
fix(misc): Fix getExactDuration behaviour when given a precision parameter (#103958)
This PR fixes a bug visible on some [alert
pages](https://sentry.sentry.io/issues/6827154726/open-periods/?project=4507946704961536&referrer=event-or-group-header).
<img width="196" height="95" alt="image"
src="https://github.com/user-attachments/assets/da0907d2-14fe-4374-ad93-a411e408629f"
/>
The predicate in the ternary fails to return true when it's supposed to
because it's matching the plural and singular version of a word. e.g. in
the above case, it doesn't match `minutes` and `minute` so it recurses
and appends a "0 minutes".
Instead of comparing `minSuffix` and `suffix` we now just compare
`precision` (the minimum unit) and the unit of the block.1 parent 74b88cb commit a5fb4da
File tree
2 files changed
+7
-5
lines changed- static/app/utils/duration
2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
0 commit comments