2021-04-11 14:18:30 +00:00
|
|
|
var DateFormatter = require("slidingtext.dtfmt.js");
|
|
|
|
const hoursToText = require("slidingtext.utils.en.js").hoursToText;
|
|
|
|
const numberToText = require("slidingtext.utils.en.js").numberToText;
|
2022-10-05 15:28:33 +00:00
|
|
|
const dayOfWeek = require("slidingtext.utils.en.js").dayOfWeek;
|
|
|
|
const numberToDayNumberText = require("slidingtext.utils.en.js").numberToDayNumberText;
|
|
|
|
const monthToText = require("slidingtext.utils.en.js").monthToText;
|
2021-04-11 14:18:30 +00:00
|
|
|
|
|
|
|
class EnglishDateFormatter extends DateFormatter {
|
2022-08-06 01:18:25 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
2022-09-29 18:05:44 +00:00
|
|
|
this.row_types = {
|
2022-10-05 15:28:33 +00:00
|
|
|
small: {size: 'vvsmall'}
|
2022-09-29 18:05:44 +00:00
|
|
|
};
|
|
|
|
this.row_defs = [
|
|
|
|
{
|
|
|
|
type: 'large',
|
2022-10-05 15:28:33 +00:00
|
|
|
init_coords: [0.05,0.07],
|
2022-09-29 18:05:44 +00:00
|
|
|
row_direction: [0.0,1.0],
|
|
|
|
rows: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'medium',
|
2022-10-05 15:28:33 +00:00
|
|
|
init_coords: [0.05,0.31],
|
2022-09-29 18:05:44 +00:00
|
|
|
row_direction: [0.0,1.0],
|
|
|
|
rows: 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'small',
|
2022-10-05 15:28:33 +00:00
|
|
|
init_coords: [0.05,0.8],
|
2022-09-29 18:05:44 +00:00
|
|
|
row_direction: [0.0,1.0],
|
2022-10-05 15:28:33 +00:00
|
|
|
rows: 2
|
2022-08-06 01:18:25 +00:00
|
|
|
}
|
2022-09-29 18:05:44 +00:00
|
|
|
];
|
2022-08-06 01:18:25 +00:00
|
|
|
}
|
2021-04-11 14:18:30 +00:00
|
|
|
formatDate(date){
|
2022-10-05 15:28:33 +00:00
|
|
|
const hours_txt = hoursToText(date.getHours());
|
|
|
|
const mins_txt = numberToText(date.getMinutes());
|
|
|
|
const day_of_week = dayOfWeek(date);
|
2022-10-05 22:50:24 +00:00
|
|
|
const date_txt = numberToDayNumberText(date.getDate()).join(' ');
|
2022-10-05 15:28:33 +00:00
|
|
|
const month = monthToText(date);
|
|
|
|
return [hours_txt,mins_txt[0],mins_txt[1],day_of_week,date_txt,month];
|
2022-08-06 01:18:25 +00:00
|
|
|
}
|
2022-09-29 18:05:44 +00:00
|
|
|
defaultRowTypes(){ return this.row_types;}
|
|
|
|
|
|
|
|
defaultRowDefs(){ return this.row_defs; }
|
2021-04-11 14:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = EnglishDateFormatter;
|