Include hours and minutes in the expiresAt field
Change-Id: I41799449e720f123bcf6d7c750291ae378c0bd31
diff --git a/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/MessageOfTheDayImpl.java b/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/MessageOfTheDayImpl.java
index a3df2cd..14a8c01 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/MessageOfTheDayImpl.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/messageoftheday/MessageOfTheDayImpl.java
@@ -67,7 +67,7 @@
return null;
}
- if (today().compareTo(expiresAt) > 0) {
+ if (now().compareTo(expiresAt) > 0) {
return null;
}
@@ -93,7 +93,7 @@
}
}
- private static String today() {
- return new SimpleDateFormat("YYYYMMdd").format(new Date());
+ private static String now() {
+ return new SimpleDateFormat("YYYYMMdd:HHmm").format(new Date());
}
}
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 73b74ab..ea23057 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -11,18 +11,18 @@
```
[message]
id = hello
- expiresAt = 20161209
+ expiresAt = 20161209:1730
```
message.id
: The ID of the current message of the day.
message.expiresAt
-: Expiration date for the current message of the day. The message will be
- displayed up to and including that date. The message will not be displayed
- any more after that date. This field is required. If not set, the message
+: Expiration date:time for the current message of the day. The message will be
+ displayed up to and including that date:time. The message will not be displayed
+ any more after that date:time. This field is required. If not set, the message
will not be displayed.
- The format of this field is `YYYYMMdd`.
+ The format of this field is `YYYYMMdd:HHmm`.
## Message content and location