Skip to content

Commit

Permalink
Merge pull request #527 from alphagov/bau_use_year_instead_of_week_ye…
Browse files Browse the repository at this point in the history
…ar_when_formatting_dates

BAU — Use yyyy (year) instead of YYYY (week year) when formatting
  • Loading branch information
alexbishop1 authored Dec 29, 2020
2 parents 859478b + 4451fa8 commit 9c624a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ private DateTimeStringSerializer(Class<ZonedDateTime> t) {

@Override
public void serialize(ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString(DateTimeFormatter.ofPattern("dd MMM YYYY - HH:mm").format(zonedDateTime));
jsonGenerator.writeString(DateTimeFormatter.ofPattern("dd MMM yyyy - HH:mm").format(zonedDateTime));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class PublicAuthResource {
private static final String TOKEN_LINK_FIELD = "token_link";
private static final String TOKEN_FIELD = "token";
private static final String DESCRIPTION_FIELD = "description";
private static final String REVOKED_DATE_FORMAT_PATTERN = "dd MMM YYYY";
private static final String REVOKED_DATE_FORMAT_PATTERN = "dd MMM yyyy";

private final TokenService tokenService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@SuppressWarnings("OptionalGetWithoutIsPresent")
public class PublicAuthResourceIT {

private static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("dd MMM YYYY - HH:mm");
private static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("dd MMM yyyy - HH:mm");

private static final String SALT = "$2a$10$IhaXo6LIBhKIWOiGpbtPOu";
private static final String BEARER_TOKEN = "testbearertoken";
Expand Down Expand Up @@ -536,7 +536,7 @@ public void respondWith200_whenSingleTokenIsRevokedByTokenLink() {

revokeSingleToken(ACCOUNT_ID, "{\"token_link\" : \"" + TOKEN_LINK.toString() + "\"}")
.statusCode(200)
.body("revoked", is(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("dd MMM YYYY"))));
.body("revoked", is(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("dd MMM yyyy"))));

Optional<String> revokedInDb = app.getDatabaseHelper().lookupColumnForTokenTable("revoked", "token_link", TOKEN_LINK.toString());
assertThat(revokedInDb.isPresent(), is(true));
Expand All @@ -548,7 +548,7 @@ public void respondWith200_whenSingleTokenIsRevokedByToken() {
String fullBearerToken = BEARER_TOKEN + "qgs2ot3itqer7ag9mvvbs8snqb5jfas3";
revokeSingleToken(ACCOUNT_ID, "{\"token\" : \"" + fullBearerToken + "\"}")
.statusCode(200)
.body("revoked", is(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("dd MMM YYYY"))));
.body("revoked", is(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("dd MMM yyyy"))));

Optional<String> revokedInDb = app.getDatabaseHelper().lookupColumnForTokenTable("revoked", "token_link", TOKEN_LINK.toString());
assertThat(revokedInDb.isPresent(), is(true));
Expand Down

0 comments on commit 9c624a9

Please sign in to comment.