change: handlebar abstracts for date
This commit is contained in:
parent
496a60f2df
commit
5187a2dba6
6 changed files with 34 additions and 41 deletions
|
@ -249,12 +249,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
|
||||||
title: protocol.title,
|
title: protocol.title,
|
||||||
summary: protocol.summary,
|
summary: protocol.summary,
|
||||||
iteration: iteration + 1,
|
iteration: iteration + 1,
|
||||||
date: new Date(protocol.date).toLocaleDateString("de-DE", {
|
date: protocol.date,
|
||||||
weekday: "long",
|
|
||||||
day: "2-digit",
|
|
||||||
month: "2-digit",
|
|
||||||
year: "numeric",
|
|
||||||
}),
|
|
||||||
start: protocol.starttime,
|
start: protocol.starttime,
|
||||||
end: protocol.endtime,
|
end: protocol.endtime,
|
||||||
agenda: agenda.sort((a, b) => a.sort - b.sort),
|
agenda: agenda.sort((a, b) => a.sort - b.sort),
|
||||||
|
|
|
@ -7,7 +7,7 @@ export const protocolDemoData: {
|
||||||
title: string;
|
title: string;
|
||||||
summary: string;
|
summary: string;
|
||||||
iteration: number;
|
iteration: number;
|
||||||
date: string;
|
date: Date;
|
||||||
start: string;
|
start: string;
|
||||||
end: string;
|
end: string;
|
||||||
agenda: Array<Partial<protocolAgenda>>;
|
agenda: Array<Partial<protocolAgenda>>;
|
||||||
|
@ -19,12 +19,7 @@ export const protocolDemoData: {
|
||||||
title: "Beispiel Protokoll Daten",
|
title: "Beispiel Protokoll Daten",
|
||||||
summary: "Zusammenfassung der Demodaten.",
|
summary: "Zusammenfassung der Demodaten.",
|
||||||
iteration: 1,
|
iteration: 1,
|
||||||
date: new Date().toLocaleDateString("de-DE", {
|
date: new Date(),
|
||||||
weekday: "long",
|
|
||||||
day: "2-digit",
|
|
||||||
month: "2-digit",
|
|
||||||
year: "numeric",
|
|
||||||
}),
|
|
||||||
start: "19:00:00",
|
start: "19:00:00",
|
||||||
end: "21:00:00",
|
end: "21:00:00",
|
||||||
agenda: [
|
agenda: [
|
||||||
|
|
|
@ -8,6 +8,14 @@ Handlebars.registerHelper("date", function (aString) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("weekdayDayMonth", function (aString) {
|
||||||
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
|
weekday: "long",
|
||||||
|
day: "2-digit",
|
||||||
|
month: "long",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper("longdate", function (aString) {
|
Handlebars.registerHelper("longdate", function (aString) {
|
||||||
return new Date(aString).toLocaleDateString("de-DE", {
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
weekday: "long",
|
weekday: "long",
|
||||||
|
@ -27,6 +35,27 @@ Handlebars.registerHelper("datetime", function (aString) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("longdatetime", function (aString) {
|
||||||
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
|
day: "2-digit",
|
||||||
|
month: "long",
|
||||||
|
year: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("longdatetimeWithWeekday", function (aString) {
|
||||||
|
return new Date(aString).toLocaleDateString("de-DE", {
|
||||||
|
weekday: "long",
|
||||||
|
day: "2-digit",
|
||||||
|
month: "long",
|
||||||
|
year: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper("json", function (context) {
|
Handlebars.registerHelper("json", function (context) {
|
||||||
return JSON.stringify(context);
|
return JSON.stringify(context);
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,33 +66,7 @@ export abstract class NewsletterHelper {
|
||||||
title: d.diffTitle || d.calendar.title,
|
title: d.diffTitle || d.calendar.title,
|
||||||
content: d.diffDescription || d.calendar.content,
|
content: d.diffDescription || d.calendar.content,
|
||||||
starttime: d.calendar.starttime,
|
starttime: d.calendar.starttime,
|
||||||
formattedStarttime: new Date(d.calendar.starttime).toLocaleDateString("de-DE", {
|
|
||||||
weekday: "long",
|
|
||||||
day: "2-digit",
|
|
||||||
month: "long",
|
|
||||||
}),
|
|
||||||
formattedFullStarttime: new Date(d.calendar.starttime).toLocaleDateString("de-DE", {
|
|
||||||
weekday: "long",
|
|
||||||
day: "2-digit",
|
|
||||||
month: "long",
|
|
||||||
year: "numeric",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
}),
|
|
||||||
endtime: d.calendar.endtime,
|
endtime: d.calendar.endtime,
|
||||||
formattedEndtime: new Date(d.calendar.endtime).toLocaleDateString("de-DE", {
|
|
||||||
weekday: "long",
|
|
||||||
day: "2-digit",
|
|
||||||
month: "long",
|
|
||||||
}),
|
|
||||||
formattedFullEndtime: new Date(d.calendar.endtime).toLocaleDateString("de-DE", {
|
|
||||||
weekday: "long",
|
|
||||||
day: "2-digit",
|
|
||||||
month: "long",
|
|
||||||
year: "numeric",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
}),
|
|
||||||
location: d.calendar.location,
|
location: d.calendar.location,
|
||||||
}))
|
}))
|
||||||
.sort((a, b) => a.starttime.getTime() - b.starttime.getTime()),
|
.sort((a, b) => a.starttime.getTime() - b.starttime.getTime()),
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<br />
|
<br />
|
||||||
{{#each dates}}
|
{{#each dates}}
|
||||||
<div>
|
<div>
|
||||||
<h2><b>{{this.formattedStarttime}}: {{this.title}}</b></h2>
|
<h2><b>{{weekdayDayMonth this.starttime}}: {{this.title}}</b></h2>
|
||||||
<span>{{{this.content}}}</span>
|
<span>{{{this.content}}}</span>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{{title}}</h1>
|
<h1>{{title}}</h1>
|
||||||
<p>Am {{date}} von {{start}} Uhr bis {{end}} Uhr</p>
|
<p>Am {{longdate date}} von {{start}} Uhr bis {{end}} Uhr</p>
|
||||||
<p>Ausdruck Nr {{iteration}}</p>
|
<p>Ausdruck Nr {{iteration}}</p>
|
||||||
<br />
|
<br />
|
||||||
<p><b>Zusammenfassung:</b></p>
|
<p><b>Zusammenfassung:</b></p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue