Dashboards: Add feature restore dashboards backend (#83131)

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Ezequiel Victorero
2024-05-16 14:36:26 -03:00
committed by GitHub
parent edae5fc791
commit 42d75ac737
30 changed files with 1230 additions and 96 deletions

View File

@@ -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