Allow selecting schedule time for message

This commit is contained in:
Moez Bhatti
2018-06-26 17:00:42 -04:00
parent 431edfe2ee
commit 75b728c301
11 changed files with 189 additions and 32 deletions
@@ -75,4 +75,16 @@ class DateFormatter @Inject constructor(val context: Context) {
}.format(date)
}
fun getScheduledTimestamp(date: Long): String {
val now = Calendar.getInstance()
val then = Calendar.getInstance()
then.timeInMillis = date
return when {
now.isSameDay(then) -> getFormatter("h:mm a")
now.isSameYear(then) -> getFormatter("MMM d h:mm a")
else -> getFormatter("MMM d yyyy h:mm a")
}.format(date)
}
}