Commit b4410e77 authored by Curtis Adam's avatar Curtis Adam

Use moments.js to format the web-push deadlines

parent 89ccc121
......@@ -4,6 +4,11 @@ import {Leitner} from "../imports/api/learned.js";
import {AdminSettings} from "../imports/api/adminSettings.js";
import {Cardsets} from "../imports/api/cardsets.js";
function getDateString(date) {
let dateFormat = "D. MMMM YYYY";
return moment(date).locale(Meteor.settings.mail.language).format(dateFormat);
}
/**
* Class used for generating the text of web-push notifications
*/
......@@ -24,9 +29,9 @@ export class WebNotifier {
deadline = new Date(active.currentDate.getTime() + cardset.daysBeforeReset * 86400000);
}
if (deadline.getTime() > cardset.learningEnd.getTime()) {
return (TAPi18n.__('notifications.deadline', null, Meteor.settings.mail.language) + cardset.learningEnd.toLocaleDateString());
return (TAPi18n.__('notifications.deadline', null, Meteor.settings.mail.language) + getDateString(cardset.learningEnd));
} else {
return (TAPi18n.__('notifications.deadline', null, Meteor.settings.mail.language) + deadline.toLocaleDateString() + TAPi18n.__('notifications.warning', null, Meteor.settings.mail.language));
return (TAPi18n.__('notifications.deadline', null, Meteor.settings.mail.language) + getDateString(deadline) + TAPi18n.__('notifications.warning', null, Meteor.settings.mail.language));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment