TRIVIAL: fix deprecations due to momentjs upgrade
This commit is contained in:
@@ -29,7 +29,7 @@ var formatDays = function(days) {
|
||||
};
|
||||
|
||||
var shortDate = function(days){
|
||||
return moment().subtract('days', days).format('D MMM');
|
||||
return moment().subtract(days, 'days').format('D MMM');
|
||||
};
|
||||
|
||||
test("formating medium length dates", function() {
|
||||
@@ -40,7 +40,7 @@ test("formating medium length dates", function() {
|
||||
};
|
||||
|
||||
var shortDateYear = function(days){
|
||||
return moment().subtract('days', days).format('D MMM YYYY');
|
||||
return moment().subtract(days, 'days').format('D MMM YYYY');
|
||||
};
|
||||
|
||||
leaveAgo = true;
|
||||
@@ -81,7 +81,7 @@ test("formating medium length dates", function() {
|
||||
|
||||
test("formating tiny dates", function() {
|
||||
var shortDateYear = function(days){
|
||||
return moment().subtract('days', days).format("MMM 'YY");
|
||||
return moment().subtract(days, 'days').format("MMM 'YY");
|
||||
};
|
||||
|
||||
format = "tiny";
|
||||
@@ -144,7 +144,7 @@ test("formating tiny dates", function() {
|
||||
module("Discourse.Formatter");
|
||||
|
||||
test("autoUpdatingRelativeAge", function() {
|
||||
var d = moment().subtract('days',1).toDate();
|
||||
var d = moment().subtract(1, 'day').toDate();
|
||||
|
||||
var $elem = $(Discourse.Formatter.autoUpdatingRelativeAge(d));
|
||||
equal($elem.data('format'), "tiny");
|
||||
|
||||
@@ -4,7 +4,7 @@ function reportWithData(data) {
|
||||
return Discourse.Report.create({
|
||||
type: 'topics',
|
||||
data: _.map(data, function(val, index) {
|
||||
return {x: moment().subtract("days", index).format('YYYY-MM-DD'), y: val};
|
||||
return { x: moment().subtract(index, "days").format('YYYY-MM-DD'), y: val };
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ test('dataIsOld', function() {
|
||||
equal(Discourse.VersionCheck.create(args).get('dataIsOld'), expected, message);
|
||||
};
|
||||
|
||||
dataIsOld({updated_at: moment().subtract('hours', 2).toJSON()}, false, '2 hours ago');
|
||||
dataIsOld({updated_at: moment().subtract('hours', 49).toJSON()}, true, '49 hours ago');
|
||||
dataIsOld({updated_at: moment().subtract('hours', 2).toJSON(), version_check_pending: true}, true, 'version check pending');
|
||||
dataIsOld({updated_at: moment().subtract(2, 'hours').toJSON()}, false, '2 hours ago');
|
||||
dataIsOld({updated_at: moment().subtract(49, 'hours').toJSON()}, true, '49 hours ago');
|
||||
dataIsOld({updated_at: moment().subtract(2, 'hours').toJSON(), version_check_pending: true}, true, 'version check pending');
|
||||
});
|
||||
|
||||
test('staleData', function() {
|
||||
var updatedAt = function(hoursAgo) {
|
||||
return moment().subtract('hours', hoursAgo).toJSON();
|
||||
return moment().subtract(hoursAgo, 'hours').toJSON();
|
||||
};
|
||||
var staleData = function(args, expected, message) {
|
||||
equal(Discourse.VersionCheck.create(args).get('staleData'), expected, message);
|
||||
|
||||
Reference in New Issue
Block a user