reportbutton: Add date time format
This matches the screenshot plugin's date formatter. Closes runelite/runelite#1228
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
package net.runelite.client.plugins.reportbutton;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
@@ -32,6 +34,7 @@ import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.FormatStyle;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
@@ -56,6 +59,7 @@ public class ReportButtonPlugin extends Plugin
|
||||
private static final ZoneId JAGEX = ZoneId.of("Europe/London");
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM);
|
||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("MMM. dd, yyyy");
|
||||
|
||||
private Instant loginTime;
|
||||
private boolean ready;
|
||||
@@ -152,6 +156,9 @@ public class ReportButtonPlugin extends Plugin
|
||||
case LOGIN_TIME:
|
||||
reportButton.setText(getLoginTime());
|
||||
break;
|
||||
case DATE:
|
||||
reportButton.setText(getDate());
|
||||
break;
|
||||
case OFF:
|
||||
reportButton.setText("Report");
|
||||
break;
|
||||
@@ -186,4 +193,9 @@ public class ReportButtonPlugin extends Plugin
|
||||
LocalTime time = LocalTime.now(JAGEX);
|
||||
return time.format(DATE_TIME_FORMAT);
|
||||
}
|
||||
|
||||
private static String getDate()
|
||||
{
|
||||
return DATE_FORMAT.format(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.reportbutton;
|
||||
public enum TimeStyle
|
||||
{
|
||||
OFF("Off"),
|
||||
DATE("Date"),
|
||||
LOGIN_TIME("Login Timer"),
|
||||
UTC("UTC Time"),
|
||||
JAGEX("Jagex HQ Time"),
|
||||
|
||||
Reference in New Issue
Block a user