[gnome-clocks/wip/exalm/oops: 2/3] world: Fix state_class comparisons



commit 10b51c7fce9e8b9117909aec9ad7bd1a1fc8b7c3
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Feb 24 03:49:33 2020 +0500

    world: Fix state_class comparisons
    
    "Current date is past sunrise or is before sunset" is true with any time of
    day. It should be "and" instead.

 src/world.vala | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/world.vala b/src/world.vala
index e4a444c..8d7f804 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -199,19 +199,19 @@ public class Item : Object, ContentItem {
     // CSS class for the current time of day
     public string state_class {
         get {
-            if (date_time.compare (sun_rise) > 0 || date_time.compare (sun_set) < 0) {
+            if (date_time.compare (sun_rise) > 0 && date_time.compare (sun_set) < 0) {
                 return "day";
             }
 
-            if (date_time.compare (civil_rise) > 0 || date_time.compare (civil_set) < 0) {
+            if (date_time.compare (civil_rise) > 0 && date_time.compare (civil_set) < 0) {
                 return "civil";
             }
 
-            if (date_time.compare (naut_rise) > 0 || date_time.compare (naut_set) < 0) {
+            if (date_time.compare (naut_rise) > 0 && date_time.compare (naut_set) < 0) {
                 return "naut";
             }
 
-            if (date_time.compare (astro_rise) > 0 || date_time.compare (astro_set) < 0) {
+            if (date_time.compare (astro_rise) > 0 && date_time.compare (astro_set) < 0) {
                 return "astro";
             }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]