Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ethlo committed Jan 24, 2018
1 parent 1768290 commit 14a783e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/ethlo/time/FastInternetDateTimeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class FastInternetDateTimeUtil extends AbstractInternetDateTimeUtil imple
private static final char TIME_SEPARATOR = ':';
private static final char SEPARATOR_UPPER = 'T';
private static final char SEPARATOR_LOWER = 't';
private static final char SEPARATOR_SPACE = ' ';
private static final char FRACTION_SEPARATOR = '.';
private static final char ZULU_UPPER = 'Z';
private static final char ZULU_LOWER = 'z';
Expand Down Expand Up @@ -314,7 +315,7 @@ public <T extends Temporal> Temporal doParseLenient(String s, Class<T> type)
// *** Time starts ***//

// HOURS
assertPositionContains(chars, 10, SEPARATOR_UPPER, SEPARATOR_LOWER);
assertPositionContains(chars, 10, SEPARATOR_UPPER, SEPARATOR_LOWER, SEPARATOR_SPACE);
final int hour = LimitedCharArrayIntegerUtil.parsePositiveInt(chars, 11, 13);

// MINUTES
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/ethlo/time/StdJdkInternetDateTimeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ private DateTimeFormatter getFormatter(int fractionDigits)
.optionalStart()
.appendLiteral('t')
.optionalEnd()
.optionalStart()
.appendLiteral(' ')
.optionalEnd()
.appendValue(ChronoField.HOUR_OF_DAY, 2)
.appendLiteral(':')
.appendValue(ChronoField.MINUTE_OF_HOUR, 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.text.ParseException;
import java.time.DateTimeException;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.Date;

Expand Down
7 changes: 7 additions & 0 deletions src/test/java/com/ethlo/time/CorrectnessTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ public void testLowerCaseTseparator()
instance.parse(a);
}

@Test
public void testSpaceAsSeparator()
{
final String a = "1994-11-05 08:15:30z";
instance.parse(a);
}

@Test
public void testValid()
{
Expand Down

0 comments on commit 14a783e

Please sign in to comment.