-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set initialTab based on current date. #98
Set initialTab based on current date. #98
Conversation
val dayOfYear = Instant.ofEpochMilli(dayInMillis).atZone(ZoneId.systemDefault()).dayOfYear | ||
todayOfYear == dayOfYear | ||
} | ||
return if (todayPageIndex < 0) 0 else todayPageIndex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time is hard 😅 . Do we really need to go through timezones here since will have epochMillis everywhere? Maybe something like:
private fun List<DaySchedule>.todayPageIndex(): Int{
val todayPageIndex = indexOfLast { (dayInMillis, _, _) ->
System.currentTimeMillis() >= dayInMillis
}
return if (todayPageIndex < 0) 0 else todayPageIndex
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
val dayInMillis: Long, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nit: I kind of like ultra long descriptive names for those like dayStartEpochMilli
.
Actually, I'd like to rename a lot of the time
, timestamp
we have to fooEpochMilli
. That would make it more explicit what the reference point and unit is.
But dayInMillis
works too so feel free to ignore my time ramblings!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
6640e1a
to
c07cb8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 💚 !
fixes #95