mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Add feature restore dashboards backend (#83131)
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
edae5fc791
commit
42d75ac737
@@ -113,6 +113,21 @@ func GetAgeString(t time.Time) string {
|
||||
return "< 1 minute"
|
||||
}
|
||||
|
||||
func RemainingDaysUntil(expiration time.Time) string {
|
||||
currentTime := time.Now()
|
||||
durationUntil := expiration.Sub(currentTime)
|
||||
|
||||
daysUntil := int(durationUntil.Hours() / 24)
|
||||
|
||||
if daysUntil == 0 {
|
||||
return "Today"
|
||||
} else if daysUntil == 1 {
|
||||
return "Tomorrow"
|
||||
} else {
|
||||
return fmt.Sprintf("%d days", daysUntil)
|
||||
}
|
||||
}
|
||||
|
||||
// ToCamelCase changes kebab case, snake case or mixed strings to camel case. See unit test for examples.
|
||||
func ToCamelCase(str string) string {
|
||||
var finalParts []string
|
||||
|
||||
Reference in New Issue
Block a user