2022-10-06 20:20:42 +00:00
|
|
|
const DateFormatter = require("slidingtext.dtfmt.js");
|
2022-10-15 12:07:33 +00:00
|
|
|
const germanHoursToText = require("slidingtext.utils.de.js").germanHoursToText;
|
|
|
|
const germanMinsToText = require("slidingtext.utils.de.js").germanMinsToText;
|
2021-04-21 10:09:18 +00:00
|
|
|
|
2022-10-15 12:07:33 +00:00
|
|
|
/**
|
|
|
|
* German 12 hour clock
|
|
|
|
*/
|
2021-04-21 10:09:18 +00:00
|
|
|
class GermanDateFormatter extends DateFormatter {
|
2022-08-06 01:18:25 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
}
|
2021-04-21 10:09:18 +00:00
|
|
|
formatDate(date){
|
2022-10-06 20:20:42 +00:00
|
|
|
const mins = date.getMinutes();
|
|
|
|
const hourOfDay = date.getHours();
|
2022-10-15 12:07:33 +00:00
|
|
|
const hours = germanHoursToText(hourOfDay);
|
2022-08-07 22:17:39 +00:00
|
|
|
if(mins === 0){
|
2021-04-21 10:09:18 +00:00
|
|
|
return [hours,"UHR", "","",""];
|
2022-10-15 12:07:33 +00:00
|
|
|
} else {
|
2022-10-06 20:20:42 +00:00
|
|
|
const mins_txt = germanMinsToText(mins);
|
2021-04-21 10:09:18 +00:00
|
|
|
return [hours, "UHR", mins_txt[0],mins_txt[1]];
|
|
|
|
}
|
|
|
|
}
|
2022-10-08 20:46:00 +00:00
|
|
|
defaultRowTypes(){ return {};}
|
2022-09-29 18:05:44 +00:00
|
|
|
|
2022-10-08 20:46:00 +00:00
|
|
|
defaultRowDefs(){
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
type: 'large',
|
|
|
|
init_coords: [0.05,0.1],
|
|
|
|
row_direction: [0.0,1.0],
|
|
|
|
rows: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'medium',
|
|
|
|
init_coords: [0.05,0.4],
|
|
|
|
row_direction: [0.0,1.0],
|
|
|
|
rows: 3
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
2021-04-21 10:09:18 +00:00
|
|
|
}
|
|
|
|
|
2021-10-07 07:41:19 +00:00
|
|
|
module.exports = GermanDateFormatter;
|