Skip to content
Merged
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
9 changes: 6 additions & 3 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,8 @@ <h2>Edit Pomodoro</h2>

// Add a pomodoro of the same type/name on the specified day in a free slot
async function incrementPomoBlock(type, name, dayStr, isAM) {
const tz = getEffectiveTimezone();

// Get the selected duration from settings
const duration = settings[`timer_preset_${selectedPreset}`] || 25;

Expand All @@ -1642,8 +1644,8 @@ <h2>Edit Pomodoro</h2>
const endMin = isAM ? 0 : workEndMin;

// Fetch existing pomodoros for that day to find free slots
const dayStart = new Date(dayStr + 'T00:00:00');
const dayEnd = new Date(dayStr + 'T23:59:59');
const dayStart = createDateInTimezone(dayStr, '00:00', tz);
const dayEnd = createDateInTimezone(dayStr, '23:59', tz);

try {
const existingPomos = await Storage.getPomodoros(dayStart.toISOString(), dayEnd.toISOString());
Expand All @@ -1662,7 +1664,8 @@ <h2>Edit Pomodoro</h2>
for (let timeMinutes = startTimeMinutes; timeMinutes < endTimeMinutes; timeMinutes += 30) {
const hour = Math.floor(timeMinutes / 60);
const min = timeMinutes % 60;
const slotStart = new Date(dayStr + 'T' + String(hour).padStart(2, '0') + ':' + String(min).padStart(2, '0') + ':00');
const timeStr = String(hour).padStart(2, '0') + ':' + String(min).padStart(2, '0');
const slotStart = createDateInTimezone(dayStr, timeStr, tz);
const slotEnd = new Date(slotStart.getTime() + duration * 60 * 1000);

// Check if this slot overlaps with any existing pomodoro
Expand Down