rmm5t / jquery-timeago

:clock8: The original jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago").
http://timeago.yarp.com
MIT License
3.82k stars 710 forks source link

jQuery.timeago is undefined jQuery 3.4.0 #350

Closed lowwa132 closed 5 years ago

lowwa132 commented 5 years ago

I'm using yarn, and yesterday I needed to add a new package. This was my package.json:

  "dependencies": {
    "bootstrap": "4.3.1",
    "jquery": "^3.2.1",
    "jqvmap": "^1.5.1",
    "odometer": "^0.4.8",
    "popper.js": "^1.14.7",
    "select2": "^4.0.6-rc.1",
    "simplelightbox": "^1.12.1",
    "timeago": "^1.6.5"
  }

This installed a new version of jQuery, the 3.4.0 version. It seems this version is incompatible with timeago.js since jQuery.timeago is undefined in developper tools.

I updated my dependencies with "jquery": "^3.2.1 <3.4.0", and it works again.

rmm5t commented 5 years ago

Thanks for reporting this. I documented the depencies in fd74b04 and published a new v1.6.6 release.

Art4 commented 5 years ago

I manually downgraded timeago to 1.6.5 because with 1.6.6 there is a addition dependency to jQuery 3.3.1 and timeago is not available in jQuery 3.4.0 anymore in my webpack setup.

@lowwa132

It seems this version is incompatible with timeago.js since jQuery.timeago is undefined in developper tools.

This assumption seems to be wrong. I'm using jQuery 3.4.0 with timeago v1.6.5 without problems. I think your problem lies elsewhere and this "bugfix" breaks some applications.

rmm5t commented 5 years ago

@Art4 Thanks for chiming in. I'll run the test suite against jQuery 3.4 later today to verify.

rmm5t commented 5 years ago

@Art4 You're right. The timeago test suite passes 100% under jQuery 3.4.0.

@lowwa132 It's possible the test suite is missing an edge case. Could you please include the exact errors that you ran into that made you believe timeago was incompatible with jQuery 3.4.0? Better yet, please compose a simple use-case (with jsfiddle or similar) that fails with jQuery 3.4.0.

rmm5t commented 5 years ago

Follow-up: Here's the test suite running green with jQuery 3.4.0: http://timeago.yarp.com/test/

Art4 commented 5 years ago

Thanks for investigating @rmm5t

Another reason for upgrading jQuery to >3.4.0: https://www.npmjs.com/advisories/796

lowwa132 commented 5 years ago

I'm not a Webpack pro, nor JS, but it seems that with my original package.json it produces 2 jQuery source files in my app.js . Thus, if timeago is included between the 2 jQuery sources, the reference is lost. If I remove my "jquery": "^3.2.1", dependency everyrthing works. I don't really know how to fix this, but i'll search :) Sorry for the inconvenience.

rmm5t commented 5 years ago

Okay, I just released v1.6.7 that relaxes the jquery dependencies. I'm going to close this issue.

If anyone finds a reason where timeago doesn’t work with jQuery 3.4.0, please submit a use-case in the form of either a jsfiddle or a new failing test case.

Art4 commented 5 years ago

@rmm5t I've testet v1.6.7 with jQuery 3.4.0 and can confirm that everything works. Thank you very much. :+1:

@lowwa132 You can try to update manually to jQuery 3.4.0 by running npm i -S jquery@3.4.0.