mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:09:18 +08: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")) {
|
||||
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")) {
|
||||
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) {
|
||||
|
|
|
@ -80,12 +80,12 @@ export default Ember.Controller.extend({
|
|||
|
||||
@computed('problemsFetchedAt')
|
||||
problemsTimestamp(problemsFetchedAt) {
|
||||
return moment(problemsFetchedAt).format('LLL');
|
||||
return moment(problemsFetchedAt).locale('en').format('LLL');
|
||||
},
|
||||
|
||||
@computed("period")
|
||||
startDate(period) {
|
||||
let fullDay = moment().utc().subtract(1, "day");
|
||||
let fullDay = moment().locale('en').utc().subtract(1, "day");
|
||||
|
||||
switch (period) {
|
||||
case "yearly":
|
||||
|
@ -107,12 +107,12 @@ export default Ember.Controller.extend({
|
|||
|
||||
@computed()
|
||||
lastWeek() {
|
||||
return moment().utc().endOf("day").subtract(1, "week");
|
||||
return moment().locale('en').utc().endOf("day").subtract(1, "week");
|
||||
},
|
||||
|
||||
@computed()
|
||||
endDate() {
|
||||
return moment().utc().subtract(1, "day").endOf("day");
|
||||
return moment().locale('en').utc().subtract(1, "day").endOf("day");
|
||||
},
|
||||
|
||||
@computed("updated_at")
|
||||
|
@ -135,6 +135,6 @@ export default Ember.Controller.extend({
|
|||
},
|
||||
|
||||
_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")
|
||||
reportUrl(type, start_date, end_date) {
|
||||
start_date = moment(start_date).format("YYYY-MM-DD");
|
||||
end_date = moment(end_date).format("YYYY-MM-DD");
|
||||
start_date = moment(start_date).locale('en').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}`);
|
||||
},
|
||||
|
||||
valueAt(numDaysAgo) {
|
||||
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);
|
||||
if (item) {
|
||||
return item.y;
|
||||
|
@ -225,8 +225,8 @@ Report.reopenClass({
|
|||
fillMissingDates(report) {
|
||||
if (_.isArray(report.data)) {
|
||||
|
||||
const startDateFormatted = moment.utc(report.start_date).format('YYYY-MM-DD');
|
||||
const endDateFormatted = moment.utc(report.end_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).locale('en').format('YYYY-MM-DD');
|
||||
report.data = fillMissingDates(report.data, startDateFormatted, endDateFormatted);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user