Skip toLcoal if time is set to none and add a function comment
@@ -7,7 +7,13 @@ import (
"github.com/Bios-Marcel/cordless/internal/config"
)
+// TimeToString formats a time to a string depending on the users settings.
+// The time will first be converted into a local time.
func TimeToString(time *time.Time) string {
+ if config.GetConfig().Times == config.NoTime {
+ return ""
+ }
+
localTime := time.Local()
if config.GetConfig().Times == config.HourMinuteAndSeconds {
return fmt.Sprintf("%02d:%02d:%02d", localTime.Hour(), localTime.Minute(), localTime.Second())
