A file's modification date is useful context, not its history

A browser application lists two similarly named documents and displays a timestamp beside each. A newer-looking date helps a user spot a likely candidate, yet it cannot establish which file is the authoritative version, who edited it, or whether a digital signature is valid. That timestamp is metadata surfaced through a specific browser interface—not a tamper-evident audit trail.

What the browser actually exposes

In the browser, File.lastModified reports a timestamp in milliseconds since the Unix epoch. When the user agent can retrieve a file's last modification time from the underlying system, the property reflects that value. However, the File API specification also defines an explicit fallback: if the modification time is unknown, the property returns the current date and time. A recent timestamp therefore does not prove that the underlying document was recently edited.

Most interfaces format that millisecond count into a human-readable date in the user's local time zone. Formatting makes the metadata easier to scan, but it does not turn a filesystem attribute into a verified event. Accurate UI copy labels the value as "file modification date" rather than "signed at" or "received at." When a workflow needs to know when a system ingested a document, that system must record its own timestamp with clear provenance.

File objects can be constructed programmatically

Not every File instance comes straight from a user's disk picker. Application code can instantiate a File directly and pass a custom lastModified value in the constructor options—or omit the option, in which case the specification defaults to the current time.

MDN's File.lastModified reference also highlights an implementation nuance: Firefox can inherit a modification time when the constructor's fileBits parts include a File read from disk. Because behavior can vary across browsers and construction paths, applications should verify the specific environments they support rather than assuming every File object carries identical provenance.

This distinction matters whenever documents pass through a conversion, export, or download step:

  • Constructing a new File from existing bytes can attach either the current timestamp or an explicitly supplied value.
  • Two File objects showing different dates do not necessarily contain different bytes.
  • Two File objects showing the exact same date do not necessarily contain identical bytes.

A byte comparison can check exact equality; a matching cryptographic digest is strong evidence of matching content, not a mathematical guarantee, and its provenance matters. lastModified only reports file metadata.

Precision limits and careful interpretation

A rendered date string often hides seconds or milliseconds, and the underlying system clock or filesystem may itself expose coarse precision. MDN notes privacy-motivated timer precision limits alongside the difference between constructor defaults, explicitly supplied values, and filesystem timestamps. Avoid inferring a strict chronological order between two files solely from displayed timestamps when the difference falls within available precision bounds.

Good interface design lets users inspect the modification date without silently making irreversible decisions on their behalf:

  • If a document-management system needs to determine an authoritative version, rely on an explicit version identifier, source record, and confirmation step rather than sorting by lastModified.
  • When provenance is known to be missing or a fallback, surface that uncertainty; the numeric value alone does not reveal whether a fallback occurred.
  • Keep filenames and sensitive document contents out of support logs when investigating timestamp discrepancies.

Keep signature checks separate

In a document-review workflow, someone may need to open P7M files online to inspect a compatible signed envelope. We develop that browser-based reader, and its public page states that document processing happens locally in the browser. Discussing the File API here does not claim that our reader sorts files by modification date or maintains a version history.

Likewise, a file's modification metadata is completely separate from signature integrity, certificate validity dates, trust chains, and revocation status. Any unverified or unavailable status remains unknown—viewing a document's contents or seeing a plausible modification date is never a complete signature assessment. Where signing time matters, inspect the relevant cryptographic signature attributes through an appropriate verification workflow rather than elevating a filesystem date into evidence it cannot provide.

Treat a file's modification date for what it is: a helpful navigational clue whose source should be labeled clearly and kept separate from the verified record of what happened to the document.