Thread:UltimateSupreme/@comment-7159954-20140120075618/@comment-7159954-20140121141432

Perhaps you didn't read my message correctly. Mine solution isn't same as yours, at least not the one available at http://dev.wikia.com/wiki/LockForums/code.js

Here are examples.

Your solution: new Date("14:02, 21 January 2014".split(",")[1]); // Tue Jan 21 2014 00:00:00 GMT+0100 new Date("14:02, 2014 January 21".split(",")[1]); // Tue Jan 21 2014 00:00:00 GMT+0100 new Date("2014-01-21T14:02:16".split(",")[1]); // Invalid Date new Date("14:02, January 21, 2014".split(",")[1]); // Sun Jan 21 2001 00:00:00 GMT+010

Mine solution: new Date("14:02, 21 January 2014".split(/,(.+)/)[1].trim); // Tue Jan 21 2014 00:00:00 GMT+0100 new Date("14:02, 2014 January 21".split(/,(.+)/)[1].trim); // Tue Jan 21 2014 00:00:00 GMT+0100 new Date("2014-01-21T14:02:16".split(/,(.+)/)[0].trim); // Tue Jan 21 2014 15:02:16 GMT+0100 new Date("14:02, January 21, 2014".split(/,(.+)/)[1].trim); // Tue Jan 21 2014 00:00:00 GMT+0100

And doesn't have to be any specific Wikia. As I said it depends on individual user settings. Go to Special:Preferences and change "Appearance->Date format" to '2014-01-21T14:02:16' so you'll see your script fails on forums as they will use new date format to display, which doesn't contain ','. Trim could be skipped for normal cases but still needed for '2014-01-21T14:02:16' format. Otherwise it will all end as: new Date(" 2014-01-21T14:02:16  ".split(/,(.+)/)[0]); // Invalid Date as value you get from $('ul.comments li.SpeechBubble .permalink').last.text does contain spaces which fail on Date parsing for this specific format.