-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- All older Java date-time classes and newer temporal classes, output…
… in "one field" when in Map form. - Many, many new tests added - Timezone handling improved - ZonedDateTime ISO_ZONE_DATE_TIME format used consistently and round trips. - GMT time supported but turns into Etc/GMT internally.
- Loading branch information
Showing
11 changed files
with
288 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,12 @@ | |
import java.time.ZonedDateTime; | ||
import java.util.Calendar; | ||
import java.util.Date; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import java.util.TimeZone; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
import com.cedarsoftware.util.CompactMap; | ||
import static com.cedarsoftware.util.convert.MapConversions.INSTANT; | ||
|
||
/** | ||
* @author Kenny Partlow ([email protected]) | ||
|
@@ -38,13 +39,11 @@ | |
final class InstantConversions { | ||
|
||
private InstantConversions() {} | ||
|
||
static Map toMap(Object from, Converter converter) { | ||
long sec = ((Instant) from).getEpochSecond(); | ||
int nanos = ((Instant) from).getNano(); | ||
Map<String, Object> target = CompactMap.<String, Object>builder().insertionOrder().build(); | ||
target.put("seconds", sec); | ||
target.put("nanos", nanos); | ||
Instant instant = (Instant) from; | ||
Map<String, Object> target = new LinkedHashMap<>(); | ||
target.put(INSTANT, instant.toString()); // Uses ISO-8601 format | ||
return target; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.