date format is changes

This commit is contained in:
Mariya
2023-12-15 18:35:41 +05:30
parent 83dbadef00
commit ba981e2b82
2 changed files with 7 additions and 8 deletions

View File

@@ -241,10 +241,8 @@ class UserListFragment : BaseFragment() {
val downloadList = mutableListOf<UserData>()
userDataList.forEach { userData ->
// Log details for debugging
Log.d("DownloadDebug", "userData: $userData, isCSVCreated: ${userData.isCSVCreated}")
if (userData.isCSVCreated) {
if (!userData.isCSVCreated) {
downloadList.add(userData)
}
}

View File

@@ -83,7 +83,7 @@ class RegistrationViewModel @Inject constructor(
fun createCSV(userData: List<UserData>, appContext: Context) =
viewModelScope.launch {
val fileName = "${getCurrentDate()}.csv"
val fileName = "${getCurrentDateTime()}.csv"
if (localFileDataSource.exportDataToCSV(fileName, userData)) {
userData.forEach { data ->
data.localFlag = true
@@ -95,9 +95,10 @@ class RegistrationViewModel @Inject constructor(
}
}
private fun getCurrentDate(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val currentDate = Date()
return dateFormat.format(currentDate)
private fun getCurrentDateTime(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy HH:mm:ss", Locale.getDefault())
val currentDateTime = Date()
return dateFormat.format(currentDateTime)
}
}