mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-05 23:20:48 +07:00
Made datetime in modscreen parsable for Java 7 phones
And now date display is localized too which is nice
This commit is contained in:
parent
fb4a091635
commit
7ddbac1f07
@ -4,15 +4,15 @@ Added "Updated!" next to updated mods in mod management screen
|
||||
|
||||
Added 'last updated time' and 'open Github page of mod' in mod management screen
|
||||
|
||||
Can no longer enter diplomacy screen for self, defeated and spectator civs through diplomacy overview screen
|
||||
Cannot enter diplomacy screen for self, defeated and spectator civs through diplomacy overview
|
||||
|
||||
Resolved #3817 - don't display resource requirements from uniques twice
|
||||
|
||||
By SomeTroglodyte:
|
||||
|
||||
- Solves #3802 Mod translations don't appear in new game screen
|
||||
- Modify choice of city to own the tiles acquired by a citadel - v2
|
||||
- Make city center unpillagable using a unique
|
||||
- Mod translations now appear in new game screen
|
||||
- Citadel tiles don't attach to razing cities if possible
|
||||
- City center now unpillagable
|
||||
|
||||
Parameterize civ-wide sight bonus - By SpacedOutChicken
|
||||
|
||||
|
@ -14,6 +14,8 @@ import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.mainmenu.Github
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
@ -113,8 +115,13 @@ class ModManagementScreen: PickerScreen() {
|
||||
}
|
||||
|
||||
if (updatedAt != "") {
|
||||
val updateString = "{Updated}: " + LocalDateTime.parse(updatedAt, DateTimeFormatter.ISO_DATE_TIME)
|
||||
.toLocalDate().toString()
|
||||
// Everything under java.time is from Java 8 onwards, meaning older phones that use Java 7 won't be able to handle it :/
|
||||
// So we're forced to use ancient Java 6 classes instead of the newer and nicer LocalDateTime.parse :(
|
||||
// Direct solution from https://stackoverflow.com/questions/2201925/converting-iso-8601-compliant-string-to-java-util-date
|
||||
val df2 = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US) // example: 2021-04-11T14:43:33Z
|
||||
val date = df2.parse(updatedAt)
|
||||
|
||||
val updateString = "{Updated}: " +DateFormat.getDateInstance(DateFormat.SHORT).format(date)
|
||||
modActionTable.add(updateString.toLabel())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user