Skip to content

Capture growth weight as pounds and ounces - #293

Merged
mike12806 merged 1 commit into
mainfrom
claude/capture-lbs-oz-b9zocl
Aug 5, 2026
Merged

Capture growth weight as pounds and ounces#293
mike12806 merged 1 commit into
mainfrom
claude/capture-lbs-oz-b9zocl

Conversation

@mike12806

Copy link
Copy Markdown
Owner

What

The Add/Edit Measurement dialog only accepted a single decimal weight, which doesn't match how baby weights are actually reported ("7 lb 4 oz"). When the weight unit is lb, the form now shows a companion oz field.

How

  • New client/src/utils/weight.ts with lbOzToPounds, poundsToLbOz, and formatWeight.
  • The lb + oz pair is combined into the decimal pounds value that is already persisted, so no API or schema changesweight stays a single number with a weight_unit.
  • Editing an existing pound entry splits the stored decimal back into lb + oz (ounces keep one decimal place so half-ounce scales round-trip).
  • Pound weights display as "7 lb 4 oz" on the history cards and the weight stat tile; other units keep their existing <value> <unit> rendering and single-field entry.
  • Switching the unit away from lb hides and clears the oz field.

Testing

  • client/test/weight.test.ts — conversion and formatting, including round-trips and the 16 oz carry.
  • client/test/GrowthWeight.test.tsx — dialog behavior: lb + oz saves 7.25, oz-only saves 0.75, blank saves null, oz field hidden for metric units, and an existing 7.25 lb entry renders as "7 lb 4 oz" and round-trips through edit.
  • Full client suite (111 tests) and tsc --noEmit pass. Layout verified at 390px width — the Unit dropdown stays aligned with the Height and Head Circumference rows.

Generated by Claude Code

The growth form only accepted a single decimal weight, which is awkward
for the way baby weights are actually reported ("7 lb 4 oz"). When the
weight unit is lb, the form now shows a companion oz field and combines
the pair into the decimal pounds value we already persist, so nothing
changes in the API or schema.

Stored pound weights are split back into lb + oz when editing, and are
displayed as "7 lb 4 oz" on the entry cards and the weight stat tile.
Other units keep the existing single-field behavior.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TmBPUwpgaXgFNxxeXChutK
@mike12806
mike12806 marked this pull request as ready for review August 5, 2026 14:46
@mike12806
mike12806 enabled auto-merge (squash) August 5, 2026 14:46
@mike12806
mike12806 merged commit 93f2ced into main Aug 5, 2026
6 checks passed
@mike12806
mike12806 deleted the claude/capture-lbs-oz-b9zocl branch August 5, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants