I'm trying to display the last updated time of a file (not my html file, another file).
HTML:
<p>Last updated: <span id="lastUpdate"></span></p>
JavaScript:
var file = 'data/myFile.csv';
var modifiedTime = new Date(file.lastModified);
document.getElementById('lastUpdate').innerHTML = modifiedTime;
When I run it, it just displays the following; (with no errors in the console)
Last updated: Invalid Date
I'm obviously missing something, probably something small.
Edit:
My files are setup like below:
site/index.html
site/data/myFile.csv
site/js/lastUpdate.js