TimeRange: Parse duration with d/M/y unit #1212
Open
+17
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
![image](https://private-user-images.githubusercontent.com/35176601/408628728-1d106235-6aac-4143-9a13-345c4998706d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjgxMzYsIm5iZiI6MTczOTE2NzgzNiwicGF0aCI6Ii8zNTE3NjYwMS80MDg2Mjg3MjgtMWQxMDYyMzUtNmFhYy00MTQzLTlhMTMtMzQ1YzQ5OTg3MDZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA2MTAzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5MmM5YTg1YmJkMGQwOTQ5ZTVlNTJjNTdmNWFiYTQ0ZWM4MGVmYzZmMjRmNTkwNGU2Nzc5NjIzM2VlYjM5ZjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.t45h_o-vg0PSiFyHd3CvRetTxt2850zF3NX7bjAc5sA)
This PR updates the parse function to use our own
ParseDuration
function instead of the Golang one. The Golang one doesn't handle unit liked
,M
ory
that are valid units in Grafana frontend when setting a panel relative time range:Which issue(s) this PR fixes:
https://github.com/grafana/support-escalations/issues/14375
Special notes for your reviewer:
now-1M
. Maybe we should update the doc to recommend using the second syntax instead of the first one?