feat: fix bug and useing sqlite to store data

This commit is contained in:
2024-08-30 17:50:01 +08:00
parent e56260bdd6
commit 2e4996ef01
13 files changed
+185 -89

No files matched your search

@@ -8,13 +8,10 @@
package cn.rtast.fancybot.util
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
fun Long.isSameDay(other: Long): Boolean {
val currentDate = LocalDate.now()
val dateToCompare = Instant.ofEpochSecond(other)
.atZone(ZoneId.systemDefault())
.toLocalDate()
return currentDate == dateToCompare
fun Long.isSameDay(otherTimestamp: Long, zoneId: ZoneId = ZoneId.systemDefault()): Boolean {
val thisDate = Instant.ofEpochMilli(this).atZone(zoneId).toLocalDate()
val otherDate = Instant.ofEpochMilli(otherTimestamp).atZone(zoneId).toLocalDate()
return thisDate == otherDate
}