Skip to content

Commit 73f7461

Browse files
committed
Added abit more info.
1 parent 5736f67 commit 73f7461

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

  • src/main/java/org/mangorage/mangobotsite/website/servlet/data/category

src/main/java/org/mangorage/mangobotsite/website/servlet/data/category/CategoryData.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,24 @@
33
import net.dv8tion.jda.api.JDA;
44
import org.mangorage.mangobotplugin.commands.trick.Trick;
55

6+
import java.time.Instant;
7+
import java.time.ZoneId;
8+
import java.time.ZonedDateTime;
9+
import java.time.format.DateTimeFormatter;
610
import java.util.List;
711

812
public record CategoryData(String name, List<CategoryItemData> info) {
13+
static String time(long epochMilli) {
14+
// Convert milliseconds to ZonedDateTime in Los Angeles timezone
15+
ZonedDateTime zdt = Instant.ofEpochMilli(epochMilli)
16+
.atZone(ZoneId.of("America/Los_Angeles"));
17+
18+
// Create formatter for: Jan 1, 1900 @ 12:00
19+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM d, yyyy @ HH:mm (zzz)");
20+
21+
return zdt.format(formatter);
22+
}
23+
924
public static List<CategoryData> of(Trick trick, JDA jda) {
1025
final var guild = jda.getGuildById(trick.getGuildID());
1126
return List.of(
@@ -17,11 +32,6 @@ public static List<CategoryData> of(Trick trick, JDA jda) {
1732
guild == null ? "N/A" : guild.getName(),
1833
false
1934
),
20-
new CategoryItemData(
21-
"Guild Id",
22-
trick.getGuildID() + "",
23-
false
24-
),
2535
new CategoryItemData(
2636
"Guild ID",
2737
trick.getGuildID() + "",
@@ -44,12 +54,12 @@ public static List<CategoryData> of(Trick trick, JDA jda) {
4454
),
4555
new CategoryItemData(
4656
"Created",
47-
trick.getCreated() + "",
57+
time(trick.getCreated()),
4858
false
4959
),
5060
new CategoryItemData(
5161
"Last Edited",
52-
trick.getLastEdited() + "",
62+
time(trick.getLastEdited()),
5363
false
5464
),
5565
new CategoryItemData(

0 commit comments

Comments
 (0)