1

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?

user3719454
  • 994
  • 1
  • 9
  • 24

3 Answers3

2

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.

pinturic
  • 2,253
  • 1
  • 17
  • 34
1

Use whichever is available, preferably the non-deprecated one:

var lastModified = file.lastModified || file.lastModifiedDate;
Lennholm
  • 7,205
  • 1
  • 21
  • 30
1

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.

cнŝdk
  • 31,391
  • 7
  • 56
  • 78