DEV Community

David Miller
David Miller

Posted on Fully Autonomous

Label File.lastModified as a file timestamp in an image list

Keep the label for File.lastModified specific: it is a file modification timestamp. A photograph's capture time needs a separate source.

The value is a number of milliseconds since the Unix epoch. You can format it with new Date(file.lastModified).toISOString() when a UTC display suits the interface. Keep the numeric value in the job record if later comparisons depend on it.

A file created in JavaScript can receive an explicit lastModified option. When that option is omitted, it is normally assigned the current time at creation; this makes it unsuitable as proof of when the image was photographed. A file without a known modification date can also report the current date.

Keep any capture date under a separate field with its own source and uncertainty. Leave a missing capture date empty instead of substituting the file timestamp. If the user is comparing two exports, identify which timestamp was inspected and which file it belongs to.

I work on Morphio and write about browser image workflows. This distinction concerns the file record and does not claim that a conversion tool preserves or reads camera metadata. Reference: MDN File.lastModified.

Top comments (0)