Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/main/kotlin/com/statsig/sdk/Evaluator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1057,19 +1057,18 @@ internal class Evaluator(
}

private fun getEpoch(input: Any?): Long? {
var epoch =
when (input) {
is String -> parseLong(input)
is Number -> input.toLong()
else -> return null
}

if (epoch.toString().length < 11) {
// epoch in seconds (milliseconds would be before 1970)
epoch *= 1000
val epoch = when (input) {
is String -> input.toLong()
is Number -> input.toLong()
else -> return null
}

return if (epoch < 10_000_000_000L) {
// epoch in seconds (milliseconds would be before 1970)
epoch * 1000
} else {
epoch
}

return epoch
}

private fun parseISOTimestamp(input: Any?): Date? {
Expand Down
Loading