async-datastore-client
async-datastore-client copied to clipboard
Unable to persist dates before January 1st 1970
Dates values are currently handled in the following fashion:
private static Timestamp toTimestamp(Date date) {
final long millis = date.getTime();
return Timestamp
.newBuilder()
.setSeconds(millis / 1000)
.setNanos((int) ((millis % 1000) * 1000000))
.build();
}
This results in the nanosecond value being a negative number if the supplied date is earlier than January 1st 1970.
However, according to Protobuf documentation, the accepted values are from 0 to 999,999,999 inclusive.