Reputation: 1024
On the following page they mention lastModified
and lastModifiedDate
. lastModifiedDate
is working in every browser for me (FF, Chrome, IE, Edge, Opera) but it is written that is deprecated. lastModified
doesn't exist in IE or Edge. So which to use?
Upvotes: 2
Views: 2749
Reputation: 32145
If lastModifiedDate
is deprecated
and works in every browser but lastModified
isn't working in IE
and Edge
, you can write a test to see if lastModified
is available so you can use it, otherwise use the deprecated one.
if(File.lastModified){
//Do whatever you want using File.lastModified
}else{
//Use File.lastModifiedDate
}
Just make sure you test for lastModified
in the first place as it isn't deprecated, so you avoid using the deprecated
one in most cases.
Upvotes: 1
Reputation: 7470
Use whichever is available, preferably the non-deprecated one:
var lastModified = file.lastModified || file.lastModifiedDate;
Upvotes: 1
Reputation: 2263
In this case the correct procedure is to verify programmatically if lastModified is available and in that case use it; if it is not available you should fallback to the deprecated one. In this case you are guaranteed to use the most "uptodated" standard if possible.
Upvotes: 3