mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-01-27 16:05:32 +00:00
Fixed date issues with TransformationHistory
This commit is contained in:
parent
f8ec899335
commit
1a6753d2aa
@ -15,7 +15,7 @@ android {
|
||||
minSdk = 28
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "Alpha 0.5.1"
|
||||
versionName = "Alpha 0.5.2"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.github.nacabaro.vbhelper.screens.scanScreen.converters
|
||||
|
||||
import android.icu.util.Calendar
|
||||
import android.icu.util.TimeZone
|
||||
import android.util.Log
|
||||
import androidx.activity.ComponentActivity
|
||||
import com.github.cfogrady.vbnfc.be.BENfcCharacter
|
||||
@ -243,16 +244,23 @@ class ToNfcConverter(
|
||||
.getTransformationHistory(characterId)!!
|
||||
.map {
|
||||
val date = Date(it.transformationDate)
|
||||
val calendar = android.icu.util.GregorianCalendar()
|
||||
val calendar = android.icu.util.GregorianCalendar(TimeZone.getTimeZone("UTC"))
|
||||
calendar.time = date
|
||||
|
||||
Log.d(
|
||||
"TransformationHistory",
|
||||
"Year: ${calendar.get(Calendar.YEAR)}, " +
|
||||
"Month: ${calendar.get(Calendar.MONTH) + 1}, " +
|
||||
"Day: ${calendar.get(Calendar.DAY_OF_MONTH)}"
|
||||
)
|
||||
|
||||
NfcCharacter.Transformation(
|
||||
toCharIndex = it.monIndex.toUByte(),
|
||||
year = calendar
|
||||
.get(Calendar.YEAR)
|
||||
.toUShort(),
|
||||
month = calendar
|
||||
.get(Calendar.MONTH)
|
||||
month = (calendar
|
||||
.get(Calendar.MONTH) + 1)
|
||||
.toUByte(),
|
||||
day = calendar
|
||||
.get(Calendar.DAY_OF_MONTH)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user