Attempt to handle nil start or end times

This commit is contained in:
Max Wofford
2025-04-02 18:35:58 -04:00
parent 7487b45dff
commit f692a79ef7

View File

@@ -30,8 +30,9 @@ class WakatimeService
@start_time = @scope.minimum(:time)
@end_time = @scope.maximum(:time)
summary[:start] = Time.at(@start_time).strftime("%Y-%m-%dT%H:%M:%SZ")
summary[:end] = Time.at(@end_time).strftime("%Y-%m-%dT%H:%M:%SZ")
summary[:start] = @start_time ? Time.at(@start_time).strftime("%Y-%m-%dT%H:%M:%SZ") : nil
summary[:end] = @end_time ? Time.at(@end_time).strftime("%Y-%m-%dT%H:%M:%SZ") : nil
summary[:range] = "all_time"
summary[:human_readable_range] = "All Time"