Skip to content

Commit

Permalink
fix: parse latest time format of helix teams (#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Sep 3, 2022
1 parent b732834 commit 9992956
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -17,6 +17,15 @@ public Instant deserialize(JsonParser p, DeserializationContext ctxt) throws IOE

str = str.trim();

// Accounts for https://github.com/twitchdev/issues/issues/644
if (str.startsWith("seconds:")) {
int startIndex = "seconds:".length();
int endIndex = str.indexOf(' ', startIndex + 1);
String seconds = str.substring(startIndex, endIndex > 0 ? endIndex : str.length());
return Instant.ofEpochSecond(Integer.parseInt(seconds));
}

// Accounts for https://github.com/twitchdev/issues/issues/347
if (str.endsWith(" +0000 UTC"))
str = str.substring(0, str.length() - " +0000 UTC".length()) + "Z";

Expand Down

0 comments on commit 9992956

Please sign in to comment.