diff --git a/bin/dart_debug_sample.dart b/bin/dart_debug_sample.dart index f6f44b2..bf9e3a1 100644 --- a/bin/dart_debug_sample.dart +++ b/bin/dart_debug_sample.dart @@ -2,6 +2,6 @@ import 'package:dart_debug_sample/dart_debug_sample.dart'; void main() { YukymController yukymController = YukymController(); - print(yukymController.getTyA()); // 해당 월에 맞는 자시의 국 표시 - print(yukymController.getTyB()); // 해당 시간에 맞는 자시의 국 표시 + print(yukymController.getTyA()); // 해당 월에 맞는 자시의 국 표시 경오3국 + print(yukymController.getTyB()); // 해당 시간에 맞는 자시의 국 표시 갑자7국 } diff --git a/lib/dart_debug_sample.dart b/lib/dart_debug_sample.dart index 5472e58..62f472b 100644 --- a/lib/dart_debug_sample.dart +++ b/lib/dart_debug_sample.dart @@ -1,9 +1,25 @@ import 'package:intl/intl.dart'; +//------------- + +void main() { + String nowDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); + print(nowDate); + print(nowDate.runtimeType); +} + +// || 를 && 로 +// if (nowTime.hour >= 0 || nowTime.hour < 2) { +// return timeDataOne.first.ty1; + +// if (nowTime.hour >= 0 && nowTime.hour < 2) { +// return timeDataOne.first.ty1; + +//------------- class YukymController { // DateTime.parse(_userData.value!.selectDate) - String nowDate = DateFormat('yyyy-mm-dd').format(DateTime.now()); + String nowDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); late String nowTime; @@ -42,26 +58,30 @@ class YukymController { String result = timeDataOne.first.ty12; final nowTime = DateTime.now(); - if (nowTime.hour >= 0 || nowTime.hour < 2) { + if (nowTime.hour >= 0 && nowTime.hour < 2) { return timeDataOne.first.ty1; - } else if (nowTime.hour >= 4 || nowTime.hour < 6) { + } else if (nowTime.hour >= 2 && nowTime.hour < 4) { return timeDataOne.first.ty2; - } else if (nowTime.hour >= 6 || nowTime.hour < 8) { + } else if (nowTime.hour >= 4 && nowTime.hour < 6) { return timeDataOne.first.ty3; - } else if (nowTime.hour >= 8 || nowTime.hour < 10) { + } else if (nowTime.hour >= 6 && nowTime.hour < 8) { return timeDataOne.first.ty4; - } else if (nowTime.hour >= 10 || nowTime.hour < 12) { + } else if (nowTime.hour >= 8 && nowTime.hour < 10) { return timeDataOne.first.ty5; - } else if (nowTime.hour >= 12 || nowTime.hour < 14) { + } else if (nowTime.hour >= 10 && nowTime.hour < 12) { return timeDataOne.first.ty6; - } else if (nowTime.hour >= 16 || nowTime.hour < 18) { + } else if (nowTime.hour >= 12 && nowTime.hour < 14) { return timeDataOne.first.ty7; - } else if (nowTime.hour >= 18 || nowTime.hour < 20) { + } else if (nowTime.hour >= 14 && nowTime.hour < 16) { return timeDataOne.first.ty8; - } else if (nowTime.hour >= 20 || nowTime.hour < 22) { + } else if (nowTime.hour >= 16 && nowTime.hour < 18) { return timeDataOne.first.ty9; - } else if (nowTime.hour >= 22 || nowTime.hour < 24) { + } else if (nowTime.hour >= 18 && nowTime.hour < 20) { return timeDataOne.first.ty10; + } else if (nowTime.hour >= 20 && nowTime.hour < 22) { + return timeDataOne.first.ty11; + } else { + return timeDataOne.first.ty12; } return result;