Skip to content

Inconsistency in DatasetVersionInfo model? (Date vs string) #476

Open

Description

@vera

I noticed that in the DatasetVersionInfo model, the timestamps use inconsistent types:

createTime: Date
/**
* The timestamp of the last update to this dataset version.
* Format: ISO 8601 string (e.g., "2023-06-01T12:34:56Z").
* Used for optimistic concurrency control to detect concurrent updates.
*/
lastUpdateTime: string
releaseTime?: Date

releaseTime and createTime are represented as Date objects, while lastUpdateTime is represented as an ISO 8601 string and not transformed into a Date object:

createTime: new Date(versionPayload.createTime),
lastUpdateTime: versionPayload.lastUpdateTime,
releaseTime: new Date(versionPayload.releaseTime),

The return values from the Dataverse API for retrieving a dataset version are all consistently ISO 8601 strings:

Image

I was wondering what the reason for this is, or whether this inconsistency should be cleaned up? (If so, I'd be open to opening a PR for that)

Activity

  1. vera commented on Aug 14, 2026

    @vera
    MemberAuthor

    To add to this, I think there is a bug with the releaseTime, it's being transformed to an "Invalid Date" object instead of undefined when versionPayload.releaseTime was undefined.

  2. ChengShi-1 commented on Aug 20, 2026

    @ChengShi-1
    Contributor

    I just verified that it is intentionally kept as a string. This was explicitly changed in commit 14d7990b (“fix: change lastUpdateTime type to string…”).

    This is passed unchanged as sourceLastUpdateTime for optimistic-concurrency checks when updating dataset metadata. Converting it to Date could alter its serialized actions. A Date has millisecond precision and normalizes serialization, so it may lose fractional precision or alter the original ISO representation.
    Feel free to fix the bug from ReleaseTime if you want. Thanks!

  3. vera commented on Aug 24, 2026

    @vera
    MemberAuthor

    Would it make sense to return createTime and releaseTime as strings too, for consistency?

    Feel free to fix the bug from ReleaseTime if you want. Thanks!

    OK, I'll try to open a PR with a fix when I have the time.

  4. ChengShi-1 commented on Aug 24, 2026

    @ChengShi-1
    Contributor

    Would it make sense to return createTime and releaseTime as strings too, for consistency?

    Feel free to fix the bug from ReleaseTime if you want. Thanks!

    OK, I'll try to open a PR with a fix when I have the time.

    I’d keep the current types and clarify the comment if needed. createTime and releaseTime are ordinary timestamps consumers may sort, compare, or format, so Date is the useful domain type.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions