diff --git a/src/main/kotlin/YukymController.kt b/src/main/kotlin/YukymController.kt index cd4bba7..b092664 100644 --- a/src/main/kotlin/YukymController.kt +++ b/src/main/kotlin/YukymController.kt @@ -5,7 +5,7 @@ import java.time.format.DateTimeFormatter class YukymController { - val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd")) + val nowDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) lateinit var nowTime: String @@ -35,17 +35,21 @@ class YukymController { var result = timeDataOne.first().ty12 val nowTime = LocalDateTime.now() + val hour = nowTime.hour + when { - nowTime.hour >= 0 || nowTime.hour < 2 -> return timeDataOne.first().ty1 - nowTime.hour >= 4 || nowTime.hour < 6 -> return timeDataOne.first().ty2 - nowTime.hour >= 6 || nowTime.hour < 8 -> return timeDataOne.first().ty3 - nowTime.hour >= 8 || nowTime.hour < 10 -> return timeDataOne.first().ty4 - nowTime.hour >= 10 || nowTime.hour < 12 -> return timeDataOne.first().ty5 - nowTime.hour >= 12 || nowTime.hour < 14 -> return timeDataOne.first().ty6 - nowTime.hour >= 16 || nowTime.hour < 18 -> return timeDataOne.first().ty7 - nowTime.hour >= 18 || nowTime.hour < 20 -> return timeDataOne.first().ty8 - nowTime.hour >= 20 || nowTime.hour < 22 -> return timeDataOne.first().ty9 - nowTime.hour >= 22 || nowTime.hour < 24 -> return timeDataOne.first().ty10 + hour >= 0 && hour < 2 -> return timeDataOne.first().ty1 + hour >= 2 && hour < 4 -> return timeDataOne.first().ty2 + hour >= 4 && hour < 6 -> return timeDataOne.first().ty3 + hour >= 6 && hour < 8 -> return timeDataOne.first().ty4 + hour >= 8 && hour < 10 -> return timeDataOne.first().ty5 + hour >= 10 && hour < 12 -> return timeDataOne.first().ty6 + hour >= 12 && hour < 14 -> return timeDataOne.first().ty7 + hour >= 14 && hour < 16 -> return timeDataOne.first().ty8 + hour >= 16 && hour < 18 -> return timeDataOne.first().ty9 + hour >= 18 && hour < 20 -> return timeDataOne.first().ty10 + hour >= 20 && hour < 22 -> return timeDataOne.first().ty11 + hour >= 22 && hour < 24 -> return timeDataOne.first().ty12 } return result