mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
refactor(workouts): drop the unused clock arguments of the blank draft
This commit is contained in:
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: "",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user