mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
correct localization for dashboard periods
previously would fail for non roman numerals
This commit is contained in:
parent
e1d7f3bb94
commit
cb9baaade9
@ -66,11 +66,11 @@ export default Ember.Component.extend(AsyncReport, {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (this.get("startDate")) {
|
if (this.get("startDate")) {
|
||||||
payload.data.start_date = this.get("startDate").format('YYYY-MM-DD[T]HH:mm:ss.SSSZZ');
|
payload.data.start_date = this.get("startDate").locale('en').format('YYYY-MM-DD[T]HH:mm:ss.SSSZZ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.get("endDate")) {
|
if (this.get("endDate")) {
|
||||||
payload.data.end_date = this.get("endDate").format('YYYY-MM-DD[T]HH:mm:ss.SSSZZ');
|
payload.data.end_date = this.get("endDate").locale('en').format('YYYY-MM-DD[T]HH:mm:ss.SSSZZ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._chart) {
|
if (this._chart) {
|
||||||
|
@ -80,12 +80,12 @@ export default Ember.Controller.extend({
|
|||||||
|
|
||||||
@computed('problemsFetchedAt')
|
@computed('problemsFetchedAt')
|
||||||
problemsTimestamp(problemsFetchedAt) {
|
problemsTimestamp(problemsFetchedAt) {
|
||||||
return moment(problemsFetchedAt).format('LLL');
|
return moment(problemsFetchedAt).locale('en').format('LLL');
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("period")
|
@computed("period")
|
||||||
startDate(period) {
|
startDate(period) {
|
||||||
let fullDay = moment().utc().subtract(1, "day");
|
let fullDay = moment().locale('en').utc().subtract(1, "day");
|
||||||
|
|
||||||
switch (period) {
|
switch (period) {
|
||||||
case "yearly":
|
case "yearly":
|
||||||
@ -107,12 +107,12 @@ export default Ember.Controller.extend({
|
|||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
lastWeek() {
|
lastWeek() {
|
||||||
return moment().utc().endOf("day").subtract(1, "week");
|
return moment().locale('en').utc().endOf("day").subtract(1, "week");
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
endDate() {
|
endDate() {
|
||||||
return moment().utc().subtract(1, "day").endOf("day");
|
return moment().locale('en').utc().subtract(1, "day").endOf("day");
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("updated_at")
|
@computed("updated_at")
|
||||||
@ -135,6 +135,6 @@ export default Ember.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_reportsForPeriodURL(period) {
|
_reportsForPeriodURL(period) {
|
||||||
return `/admin/dashboard-next?period=${period}`;
|
return Discourse.getURL(`/admin?period=${period}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -8,14 +8,14 @@ const Report = Discourse.Model.extend({
|
|||||||
|
|
||||||
@computed("type", "start_date", "end_date")
|
@computed("type", "start_date", "end_date")
|
||||||
reportUrl(type, start_date, end_date) {
|
reportUrl(type, start_date, end_date) {
|
||||||
start_date = moment(start_date).format("YYYY-MM-DD");
|
start_date = moment(start_date).locale('en').format("YYYY-MM-DD");
|
||||||
end_date = moment(end_date).format("YYYY-MM-DD");
|
end_date = moment(end_date).locale('en').format("YYYY-MM-DD");
|
||||||
return Discourse.getURL(`/admin/reports/${type}?start_date=${start_date}&end_date=${end_date}`);
|
return Discourse.getURL(`/admin/reports/${type}?start_date=${start_date}&end_date=${end_date}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
valueAt(numDaysAgo) {
|
valueAt(numDaysAgo) {
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
const wantedDate = moment().subtract(numDaysAgo, "days").format("YYYY-MM-DD");
|
const wantedDate = moment().subtract(numDaysAgo, "days").locale('en').format("YYYY-MM-DD");
|
||||||
const item = this.data.find(d => d.x === wantedDate);
|
const item = this.data.find(d => d.x === wantedDate);
|
||||||
if (item) {
|
if (item) {
|
||||||
return item.y;
|
return item.y;
|
||||||
@ -225,8 +225,8 @@ Report.reopenClass({
|
|||||||
fillMissingDates(report) {
|
fillMissingDates(report) {
|
||||||
if (_.isArray(report.data)) {
|
if (_.isArray(report.data)) {
|
||||||
|
|
||||||
const startDateFormatted = moment.utc(report.start_date).format('YYYY-MM-DD');
|
const startDateFormatted = moment.utc(report.start_date).locale('en').format('YYYY-MM-DD');
|
||||||
const endDateFormatted = moment.utc(report.end_date).format('YYYY-MM-DD');
|
const endDateFormatted = moment.utc(report.end_date).locale('en').format('YYYY-MM-DD');
|
||||||
report.data = fillMissingDates(report.data, startDateFormatted, endDateFormatted);
|
report.data = fillMissingDates(report.data, startDateFormatted, endDateFormatted);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user