Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong dates computed from exif strings, depending on the current date #23

Closed
maxf opened this issue May 31, 2017 · 0 comments
Closed

Wrong dates computed from exif strings, depending on the current date #23

maxf opened this issue May 31, 2017 · 0 comments

Comments

@maxf
Copy link
Contributor

maxf commented May 31, 2017

Looking at parseDateTimeParts https://github.com/bwindels/exif-parser/blob/master/lib/date.js#L11,
the date generated sometimes depends on the date that the code is run...
For instance, imagine today is the 31 May 2017 at 23:50:00, and the string to parse is '2015:09:30 11:03:09.603280'

  • var date = new Date() yields 31 May 2017, 23:50:00.
  • date.setUTCFullYear(2015) yields 31 May 2015, 23:50:00
  • date.setUTCMonth(8) yields 30 October 2015, and not 31 September 2015 (because that date doesn't exist)
  • etc. The final date is 30 October 2015, 23:50:00 - A month off.

you should use
var date = new Date(year, month, date, hours, minutes, seconds)

maxf pushed a commit to maxf/exif-parser that referenced this issue Jun 1, 2017
Otherwise the resulting date isn't always correct.
Closes bwindels#23
maxf pushed a commit to maxf/exif-parser that referenced this issue Jun 1, 2017
Otherwise the resulting date isn't always correct.
Closes bwindels#23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant