Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeline "new year" bug #1412

Merged
merged 8 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/components/MapView/DateSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ const DateSelector = memo(() => {
if (firstIndex === -1) {
return layer.dateItems;
}
// truncate the date item array at index matching timeline first date
// truncate the date item array at index matching timeline first date with a buffer of 1 day decrements
// eslint-disable-next-line fp/no-mutating-methods
return layer.dateItems.slice(firstIndex);
return layer.dateItems.slice(firstIndex - 1);
}),
];
}, [orderedLayers, timelineStartDate]);
Expand Down Expand Up @@ -365,13 +365,13 @@ const DateSelector = memo(() => {
return;
}
const time = date.getTime();
const selectedIndex = findDateIndex(selectableDates, date.getTime());
const selectedIndex = findDateIndex(availableDates, date.getTime());
checkSelectedDateForLayerSupport(date.getTime());
if (
selectedIndex < 0 ||
(stateStartDate &&
datesAreEqualWithoutTime(
selectableDates[selectedIndex],
availableDates[selectedIndex],
stateStartDate,
))
) {
Expand All @@ -381,7 +381,7 @@ const DateSelector = memo(() => {
dispatch(updateDateRange({ startDate: time }));
},
[
selectableDates,
availableDates,
checkSelectedDateForLayerSupport,
stateStartDate,
updateHistory,
Expand All @@ -396,6 +396,7 @@ const DateSelector = memo(() => {
isUpdatingHistory: boolean,
) => {
const selectedIndex = findDateIndex(availableDates, date);

if (availableDates[selectedIndex + increment]) {
updateStartDate(
new Date(availableDates[selectedIndex + increment]),
Expand Down
Loading