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
|
minSdk = 28
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "Alpha 0.5.1"
|
versionName = "Alpha 0.5.2"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.github.nacabaro.vbhelper.screens.scanScreen.converters
|
package com.github.nacabaro.vbhelper.screens.scanScreen.converters
|
||||||
|
|
||||||
import android.icu.util.Calendar
|
import android.icu.util.Calendar
|
||||||
|
import android.icu.util.TimeZone
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import com.github.cfogrady.vbnfc.be.BENfcCharacter
|
import com.github.cfogrady.vbnfc.be.BENfcCharacter
|
||||||
@ -243,16 +244,23 @@ class ToNfcConverter(
|
|||||||
.getTransformationHistory(characterId)!!
|
.getTransformationHistory(characterId)!!
|
||||||
.map {
|
.map {
|
||||||
val date = Date(it.transformationDate)
|
val date = Date(it.transformationDate)
|
||||||
val calendar = android.icu.util.GregorianCalendar()
|
val calendar = android.icu.util.GregorianCalendar(TimeZone.getTimeZone("UTC"))
|
||||||
calendar.time = date
|
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(
|
NfcCharacter.Transformation(
|
||||||
toCharIndex = it.monIndex.toUByte(),
|
toCharIndex = it.monIndex.toUByte(),
|
||||||
year = calendar
|
year = calendar
|
||||||
.get(Calendar.YEAR)
|
.get(Calendar.YEAR)
|
||||||
.toUShort(),
|
.toUShort(),
|
||||||
month = calendar
|
month = (calendar
|
||||||
.get(Calendar.MONTH)
|
.get(Calendar.MONTH) + 1)
|
||||||
.toUByte(),
|
.toUByte(),
|
||||||
day = calendar
|
day = calendar
|
||||||
.get(Calendar.DAY_OF_MONTH)
|
.get(Calendar.DAY_OF_MONTH)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user