-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix realm RealmInstant type filtering
- Loading branch information
1 parent
69b4fb2
commit 37975dc
Showing
2 changed files
with
33 additions
and
33 deletions.
There are no files selected for viewing
8 changes: 6 additions & 2 deletions
8
composeApp/src/commonMain/kotlin/com/clipevery/utils/DateUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
package com.clipevery.utils | ||
|
||
import io.realm.kotlin.types.RealmInstant | ||
import java.util.Calendar | ||
|
||
object DateUtils { | ||
|
||
fun getPrevDay(): Long { | ||
fun getPrevDay(): RealmInstant { | ||
val calendar = Calendar.getInstance() | ||
calendar.add(Calendar.DAY_OF_MONTH, -1) | ||
return calendar.timeInMillis | ||
// Convert milliseconds to seconds for the epochSeconds parameter | ||
val epochSeconds = calendar.timeInMillis / 1000 | ||
// The nanosecondAdjustment parameter is 0 as we're not adjusting nanoseconds here | ||
return RealmInstant.from(epochSeconds, 0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters