From 525716d832abee468e97d20119a5ad2cd16c2262 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 10 Mar 2021 15:51:29 +0100 Subject: [PATCH] making the weekend check more readable --- .../com/simplemobiletools/calendar/pro/helpers/Constants.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 3b234d088..5f6d96d57 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -164,5 +164,9 @@ const val REMINDER_EMAIL = 1 fun getNowSeconds() = System.currentTimeMillis() / 1000L fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean { - return (i + if (isSundayFirst) 6 else 0) % 7 > 4 + return if (isSundayFirst) { + i == 0 || i == 6 || i == 7 || i == 13 + } else { + i == 5 || i == 6 || i == 12 || i == 13 + } }