implement DateTimeProvider.kt

This commit is contained in:
Denis-Cosmin NUTIU 2024-04-10 00:02:44 +03:00
parent 113863cc97
commit 13696d3c54

View file

@ -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)
}
}