[mod] weekview:Korrekter Jahresübergang
This commit is contained in:
parent
f1a5e37feb
commit
d2f9404c6d
|
|
@ -591,8 +591,8 @@ namespace _dali.widgets
|
||||||
{
|
{
|
||||||
type type_row_data = Array<
|
type type_row_data = Array<
|
||||||
{
|
{
|
||||||
week : int;
|
head : int;
|
||||||
day_pits : Array<lib_plankton.pit.type_pit>;
|
pits : Array<lib_plankton.pit.type_pit>;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
|
@ -612,14 +612,23 @@ namespace _dali.widgets
|
||||||
lib_plankton.translate.get("common.weekday.saturday"),
|
lib_plankton.translate.get("common.weekday.saturday"),
|
||||||
lib_plankton.translate.get("common.weekday.sunday"),
|
lib_plankton.translate.get("common.weekday.sunday"),
|
||||||
];
|
];
|
||||||
const row_data_original : type_row_data = (
|
const row_data_horizontal : type_row_data = (
|
||||||
lib_plankton.list.sequence(this.count)
|
lib_plankton.list.sequence(this.count)
|
||||||
.map(
|
.map(
|
||||||
offset => {
|
offset => {
|
||||||
const week : int = (this.week + offset);
|
const week : int = (this.week + offset);
|
||||||
|
const week_adjusted : int = lib_plankton.call.convey(
|
||||||
|
this.week,
|
||||||
|
[
|
||||||
|
x => lib_plankton.pit.from_ywd({"year": this.year, "week": x, "day": 2}),
|
||||||
|
x => lib_plankton.pit.shift_week(x, offset),
|
||||||
|
lib_plankton.pit.to_ywd,
|
||||||
|
x => x.week
|
||||||
|
]
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
"week": week,
|
"head": week_adjusted,
|
||||||
"day_pits": (
|
"pits": (
|
||||||
lib_plankton.list.sequence(7)
|
lib_plankton.list.sequence(7)
|
||||||
.map(
|
.map(
|
||||||
day => lib_plankton.pit.from_ywd(
|
day => lib_plankton.pit.from_ywd(
|
||||||
|
|
@ -638,13 +647,13 @@ namespace _dali.widgets
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const row_data_alternative : type_row_data = (
|
const row_data_vertical : type_row_data = (
|
||||||
lib_plankton.list.sequence(7)
|
lib_plankton.list.sequence(7)
|
||||||
.map(
|
.map(
|
||||||
day_of_week => {
|
day_of_week => {
|
||||||
return {
|
return {
|
||||||
/*"day_of_week"*/"week": day_of_week,
|
"head": day_of_week,
|
||||||
/*"week_pits"*/"day_pits": (
|
"pits": (
|
||||||
lib_plankton.list.sequence(this.count)
|
lib_plankton.list.sequence(this.count)
|
||||||
.map(
|
.map(
|
||||||
offset => {
|
offset => {
|
||||||
|
|
@ -669,9 +678,9 @@ namespace _dali.widgets
|
||||||
const row_data : type_row_data = (
|
const row_data : type_row_data = (
|
||||||
(! this.vertical)
|
(! this.vertical)
|
||||||
?
|
?
|
||||||
row_data_original
|
row_data_horizontal
|
||||||
:
|
:
|
||||||
row_data_alternative
|
row_data_vertical
|
||||||
);
|
);
|
||||||
// head
|
// head
|
||||||
{
|
{
|
||||||
|
|
@ -713,7 +722,6 @@ namespace _dali.widgets
|
||||||
const dom_th = document.createElement("th");
|
const dom_th = document.createElement("th");
|
||||||
dom_th.classList.add("weekview-cell");
|
dom_th.classList.add("weekview-cell");
|
||||||
dom_th.classList.add("weekview-cell-day");
|
dom_th.classList.add("weekview-cell-day");
|
||||||
// const week : int = (this.week + offset);
|
|
||||||
const week : int = lib_plankton.call.convey(
|
const week : int = lib_plankton.call.convey(
|
||||||
this.week,
|
this.week,
|
||||||
[
|
[
|
||||||
|
|
@ -722,7 +730,7 @@ namespace _dali.widgets
|
||||||
lib_plankton.pit.to_ywd,
|
lib_plankton.pit.to_ywd,
|
||||||
x => x.week
|
x => x.week
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
dom_th.textContent = week.toFixed(0).padStart(2, "0");
|
dom_th.textContent = week.toFixed(0).padStart(2, "0");
|
||||||
dom_tr.appendChild(dom_th);
|
dom_tr.appendChild(dom_th);
|
||||||
}
|
}
|
||||||
|
|
@ -746,13 +754,13 @@ namespace _dali.widgets
|
||||||
"week": (
|
"week": (
|
||||||
(! this.vertical)
|
(! this.vertical)
|
||||||
?
|
?
|
||||||
row.week.toFixed(0).padStart(2, "0")
|
row.head.toFixed(0).padStart(2, "0")
|
||||||
:
|
:
|
||||||
day_names[index]
|
day_names[index]
|
||||||
),
|
),
|
||||||
"cells": (
|
"cells": (
|
||||||
await _dali.helpers.promise_row<string>(
|
await _dali.helpers.promise_row<string>(
|
||||||
row.day_pits
|
row.pits
|
||||||
.map(
|
.map(
|
||||||
(day_pit) => async () => {
|
(day_pit) => async () => {
|
||||||
const is_today : boolean = lib_plankton.pit.is_between(
|
const is_today : boolean = lib_plankton.pit.is_between(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue