implement DateTimeProvider.kt
This commit is contained in:
parent
113863cc97
commit
13696d3c54
1 changed files with 27 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
|||
package dev.nuculabs.imagetagger.ui.utils.date
|
||||
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
interface IDateTimeProvider {
|
||||
/**
|
||||
* Returns today's short date. For example: 09 April 2024
|
||||
*/
|
||||
fun getTodayShortDate(): String
|
||||
}
|
||||
|
||||
/**
|
||||
* Utilities for providing date and time related values.
|
||||
*/
|
||||
class DateTimeProvider : IDateTimeProvider {
|
||||
|
||||
/**
|
||||
* Returns today's short date. For example: 09 April 2024
|
||||
*/
|
||||
override fun getTodayShortDate(): String {
|
||||
val dateFormat: DateFormat = SimpleDateFormat("dd MMMM YYYY", Locale.ENGLISH)
|
||||
val date = Date()
|
||||
return dateFormat.format(date)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue