RelativeDateHeader.kt 725 B

1234567891011121314151617181920212223242526272829
  1. package eu.kanade.presentation.components
  2. import androidx.compose.runtime.Composable
  3. import androidx.compose.runtime.remember
  4. import androidx.compose.ui.Modifier
  5. import androidx.compose.ui.platform.LocalContext
  6. import eu.kanade.tachiyomi.util.lang.toRelativeString
  7. import java.text.DateFormat
  8. import java.util.Date
  9. @Composable
  10. fun RelativeDateHeader(
  11. modifier: Modifier = Modifier,
  12. date: Date,
  13. relativeTime: Int,
  14. dateFormat: DateFormat,
  15. ) {
  16. val context = LocalContext.current
  17. ListGroupHeader(
  18. modifier = modifier,
  19. text = remember {
  20. date.toRelativeString(
  21. context,
  22. relativeTime,
  23. dateFormat,
  24. )
  25. },
  26. )
  27. }