MediaWiki:Gadget-morebits.js: Difference between revisions

Content deleted Content added
Repo at 10a5542: Don't import methods that collide with PageTriage (T268513)
Repo at 3fd646e: Fix constructor order for firefox
Line 1,519:
Morebits.date = function() {
var args = Array.prototype.slice.call(arguments);
this._d = new (Function.prototype.bind.apply(Date, [Date].concat(args)));
 
// Check if it's a MediaWiki signature timestamp (which the native Date cannot parse directly)
if (!this.isValid()) {
// Must be first since firefox erroneously accepts the format, sans timezone
if (args.length === 1 && typeof args[0] === 'string') {
// See also: #921, #936, #1174, #1187
// Check if it's a MediaWiki signature timestamp (which the native Date cannot parse directly)
if var (dateParts) {;
var dateParts = Morebits.date.localeData.signatureTimestampFormat(args[0]);
if (args.length === 1 && typeof args[0] === 'string' && (dateParts = Morebits.date.localeData.signatureTimestampFormat(args[0]))) {
if (dateParts) {
this._d = new Date(Date.UTC.apply(null, dateParts));
} else {
}
// Try standard date
}
this._d = new (Function.prototype.bind.apply(Date, [Date].concat(args)));
}
 
// Still no?
if (!this.isValid()) {