-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DateUtilities.parse() now allows for timezone offsets to include a "s…
…econds" (third) time component. Many more conversion tests added. 682 conversions supported, 164 conversion pairs to test.
- Loading branch information
Showing
14 changed files
with
306 additions
and
96 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
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
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 |
---|---|---|
|
@@ -13,8 +13,13 @@ | |
import java.time.format.DateTimeFormatterBuilder; | ||
import java.util.Calendar; | ||
import java.util.Date; | ||
import java.util.Map; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
import com.cedarsoftware.util.CompactLinkedMap; | ||
|
||
import static com.cedarsoftware.util.convert.Converter.VALUE; | ||
|
||
/** | ||
* @author Kenny Partlow ([email protected]) | ||
* <br> | ||
|
@@ -91,7 +96,13 @@ static LocalDate toLocalDate(Object from, Converter converter) { | |
} | ||
|
||
static LocalTime toLocalTime(Object from, Converter converter) { | ||
return toZonedDateTime(from, converter).toLocalTime(); | ||
Instant instant = toInstant(from, converter); | ||
|
||
// Convert Instant to LocalDateTime | ||
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, converter.getOptions().getZoneId()); | ||
|
||
// Extract the LocalTime from LocalDateTime | ||
return localDateTime.toLocalTime(); | ||
} | ||
|
||
static BigInteger toBigInteger(Object from, Converter converter) { | ||
|
@@ -131,4 +142,11 @@ static String toString(Object from, Converter converter) { | |
|
||
return zonedDateTime.format(formatter); | ||
} | ||
|
||
static Map<String, Object> toMap(Object from, Converter converter) { | ||
Date date = (Date) from; | ||
Map<String, Object> map = new CompactLinkedMap<>(); | ||
map.put(VALUE, date.getTime()); | ||
return map; | ||
} | ||
} |
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.