Date formatting options
Describe the new feature.
The item creation date is a must for me, and although it's already implemented in the mod, it's a bit lacking.
First, it's missing the hour, which is important for me. Second, the date is formatted in a weird order which is hard to read (I think putting the month at the start is an american thing).
My suggestion is to expand the date feature and give some options to the user.
For me, the perfect formatting would be: 2023-12-31 24:00 That's the easiest format to read when you are looking for specific dates, for example, in the ah.
Say you're looking for an old AOTE from before 2019-08, reading the written month and day before the year makes the process very tedious.
Also, I know that in some EU places, it's common to format dates as dd-MM-yy. And here we use 24h clocks, but I'm sure americans would prefer 12h clocks. So adding some formatting options would be great to please everyone.
Images
No response
I have investigated a bit on this, and it turned out to be really easy to change the formatting from a code perspective. I'm not a java dev, so take my words with a grain of salt.
Here is my personal patch code snippet: /src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/ObtainedDateTooltip.java LINE 22
private static final DateTimeFormatter OBTAINED_DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm 'UTC'").withZone(ZoneId.of("UTC")).localizedBy(Locale.ENGLISH);
I also changed "withZone()" to UTC because my machine time zone is not my actual time zone, and I prefer the zulu time anyway.
I created a build with this one line change, and it seems to be working fine so far. So I think it should be easy to implement an option with different patterns to choose from. That option would replace the currently hard-coded string pattern used by "ofPattern()".
I just investigated a bit more. I'm sorry, I'm not familiarized with the project neither mc modding. I can see that the configs are not implemented in ItemUtils, and I'm sure there is a reason for it, so that's not an option.
Maybe the formatting could be passed to "getTimestamp()" as an argument?
Some issues to keep in mind:
- If the hour is displayed, there should be an option to choose from 24h or PM/AM
- If the timezone is displayed, as in the screenshot, some parsing would be needed. Especially if using the system timezone. It should be clear that the time shown is UTC+1, UTC+2, etc