refactor(workouts): drop the unused clock arguments of the blank draft

This commit is contained in:
Marc-André Bombeck committed 2026-10-04 10:18:16 +02:00
1 parent 183b7ce2c5
commit 2798cc953f
3 files changed
+3 -6

No files matched your search

@@ -116,7 +116,7 @@ export function ManualWorkoutForm({
// a submit after an edit updates the row the first submit stored.
const [externalId] = useState(newManualWorkoutExternalId);
const [draft, setDraft] = useState<ManualWorkoutDraft>(() =>
emptyManualWorkoutDraft(new Date(), timezone),
emptyManualWorkoutDraft(),
);
const [errors, setErrors] = useState<
Partial<Record<ManualWorkoutField, string>>
@@ -242,7 +242,7 @@ describe("buildManualWorkoutEntry — validation", () => {
describe("the form's defaults", () => {
it("opens with a blank start; the field caps at the current minute", () => {
expect(wallClockNow(NOW, "Europe/Berlin")).toBe("2026-09-15T14:00");
expect(emptyManualWorkoutDraft(NOW, "Asia/Seoul")).toMatchObject({
expect(emptyManualWorkoutDraft()).toMatchObject({
sportType: "",
start: "",
hours: "",
+1 -4
View File
@@ -118,10 +118,7 @@ export function wallClockNow(now: Date, timezone: string): string {
return `${p.year}-${pad(p.month)}-${pad(p.day)}T${pad(p.hour)}:${pad(p.minute)}`;
}
export function emptyManualWorkoutDraft(
now: Date,
timezone: string,
): ManualWorkoutDraft {
export function emptyManualWorkoutDraft(): ManualWorkoutDraft {
return {
sportType: "",
// Blank on purpose (#1085): a blank start means "it just ended", so the