Skip to content
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
8 changes: 4 additions & 4 deletions src/components/EphController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const EphController = () => {

useEffect(() => {
if (trigger && params) {
const startPos = dateTimeToPos(params.startDate, "12:00:00");
const endPos = dateTimeToPos(params.endDate, "12:00:00");
const startPos = dateTimeToPos(params.startDate, "00:00:00");
const endPos = dateTimeToPos(params.endDate, "00:00:00");
if (params.checkedPlanets.length > 0 && startPos <= endPos) {
setDone(false);
}
Expand All @@ -82,8 +82,8 @@ const EphController = () => {

const { startDate, endDate, stepSize, stepFactor, checkedPlanets } = params;

const startPos = dateTimeToPos(startDate, "12:00:00");
const endPos = dateTimeToPos(endDate, "12:00:00");
const startPos = dateTimeToPos(startDate, "00:00:00");
const endPos = dateTimeToPos(endDate, "00:00:00");
const increment = stepSize * stepFactor;

const ephemeridesData = {};
Expand Down
19 changes: 18 additions & 1 deletion src/components/Menus/Ephemerides.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ const Ephemerides = () => {
}
};

// Effect to update Start/End Date to current position when menu is opened
useEffect(() => {
if (ephimerides) {
const currentDate = posToDate(posRef.current);

// Update valuesRef so generation uses the new date
valuesRef.current["Start Date"] = currentDate;
valuesRef.current["End Date"] = currentDate;

// Update Leva UI to show the new date
levaEphStore.set({
"Start Date": currentDate,
"End Date": currentDate
});
}
}, [ephimerides, posRef, levaEphStore]);

useControls(
{
Generate: button(handleCreate),
Expand Down Expand Up @@ -132,4 +149,4 @@ const Ephemerides = () => {
);
};

export default Ephemerides;
export default Ephemerides;
Loading