mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-28 03:04:14 +00:00
parent
a37dfd80a8
commit
b7d3b34619
3 changed files with 14 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
|||
## Fixed
|
||||
|
||||
* Transient fields are not written to TOML files (thanks to __[lare96](https://github.com/lare96)__)
|
||||
* Support positive timezone offset in datetime (thanks to __[aloyse](https://github.com/aloyse)__)
|
||||
|
||||
## 0.5.1 / 2016-01-24
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class DateValueReaderWriter implements ValueReader, ValueWriter {
|
|||
|
||||
for (int i = index.get(); i < original.length(); i = index.incrementAndGet()) {
|
||||
char c = original.charAt(i);
|
||||
if (Character.isDigit(c) || c == '-' || c == ':' || c == '.' || c == 'T' || c == 'Z') {
|
||||
if (Character.isDigit(c) || c == '-' || c == '+' || c == ':' || c == '.' || c == 'T' || c == 'Z') {
|
||||
sb.append(c);
|
||||
} else {
|
||||
index.decrementAndGet();
|
||||
|
|
|
@ -27,7 +27,18 @@ public class DateTest {
|
|||
Toml toml = new Toml().read("a_date = 1979-05-27T00:32:00-07:00");
|
||||
|
||||
Calendar calendar = Calendar.getInstance(UTC);
|
||||
calendar.set(1979, Calendar.MAY, 27, 7, 32, 00);
|
||||
calendar.set(1979, Calendar.MAY, 27, 7, 32, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
assertEquals(calendar.getTime(), toml.getDate("a_date"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_get_date_with_positive_offset() throws Exception {
|
||||
Toml toml = new Toml().read("a_date = 1979-05-27T07:32:00+07:00");
|
||||
|
||||
Calendar calendar = Calendar.getInstance(UTC);
|
||||
calendar.set(1979, Calendar.MAY, 27, 0, 32, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
assertEquals(calendar.getTime(), toml.getDate("a_date"));
|
||||
|
|
Loading…
Reference in a new issue