This repository was archived by the owner on Dec 3, 2023. It is now read-only.

Description
The Javadoc for com.google.cloud.Timestamp.parseTimestamp says that the input doesn't have a timezone offset and ends with "Z":
|
/** |
|
* Creates a Timestamp instance from the given string. String is in the RFC 3339 format without |
|
* the timezone offset (always ends in "Z"). |
|
*/ |
|
public static Timestamp parseTimestamp(String timestamp) { |
However, it seems to parse offsets correctly with google-cloud-core 1.93.7:
import com.google.cloud.Timestamp;
import org.junit.Test;
public class TimestampTest {
@Test
public void parseTimestamp() {
System.err.println(Timestamp.parseTimestamp("2020-07-10T14:03:00-07:00"));
System.err.println(Timestamp.parseTimestamp("2020-07-10T14:03:00Z"));
}
}
2020-07-10T21:03:00Z
2020-07-10T14:03:00Z
I would expect either of the following:
- parseTimestamp handles a timezone offset, and the documentation doesn't specify that there is no offset.
- parseTimestamp doesn't handle a timezone offset and throws an exception when one is present.
This issue may be related to googleapis/google-cloud-java#4583. The fix changed the parsing logic but not the documentation.