Datetime rounding - losing information!

We’re losing information when we use the CustomMetadataDateTime field type. We use CustomMetadataDateTime field types to store the exact start and end times of the videos we’re labeling. It’s important these datetime fields are accurate to the subsecond. However, Labelbox is rounding down our date object’s subsecond values. This definitely seems like a bug to me. We can work around this by storing our date objects as strings, but we’d certainly prefer to store our date values as date types. We tried to store the dates as isoFormat strings, but Labelbox rejected these string values. It appears Labelbox validates the string, and if it’s an isoFormat date, it rejects the value. We’ve settled with storing our dates in epoch string format :cry:.

Hey @btalberg ,

Can you provide a sample of date/time you are passing through in your code to set the metadata?\

We validate date as ISO 8601.

dataMetdataVal

Based on the logic alone I’m unsure we would do any rounding.

Many thanks,
PT
Labelbox Support

@ptancre - I recreated the issue via a notebook: https://github.com/btalberg/labelbox-demo-date-metadata-field-bug/blob/main/test_labelbox_dates_metadata.ipynb

  1. In the notebook I’m creating a datetime object:
datetime.fromisoformat('2023-08-07 09:00:05.450+00:00')
  1. I then create the metadata date field, I create an example dataset, and I upload a datarow with the my datetime object
  2. I export the data (using export_v2) and test if the value from the export matches the value I uploaded and/or if the microseconds have been scrubbed

I also took a look through the UI, and that too shows the microseconds have been scrubbed:

@btalberg , Appreciate you took the time to do this, I will be looking into it and keep you posted!

Any word on this issue, @ptancre ? Like I mentioned, we worked around it by storing epoch information in a string meta field. Would be nice to simply use dates though. Thanks!

Hi @btalberg ,

So basically we don’t round, we do not store at the moment milliseconds in our database.

  • We validate against ISO-8601 as shared previously (so you can pass your date no issue)
  • But only store up to the second

One of my colleague raised that internally as a feedback so once we implement change on how we store date I will let you know.

Many thanks,
Paul Tancré
Labelbox Support
Please visit our Community @ https://community.labelbox.com/