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

Confusing documentation for com.google.cloud.Timestamp.parseTimestamp #254

Description

@sebright2

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:

  1. parseTimestamp handles a timezone offset, and the documentation doesn't specify that there is no offset.
  2. 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.

Activity

  1. self-assigned this
    on Jul 11, 2020
  2. added
    type: docsImprovement to the documentation for an API.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    and removed
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Jul 16, 2020
  3. removed
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Jul 20, 2020
  4. sebright2 commented on Jul 24, 2020

    @sebright2
    Author

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions