Skip to content

Commit

Permalink
fix: negative signs affecting number parsing with date segments
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Mar 2, 2025
1 parent 8a27ecc commit c3f2be2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fair-hoops-ask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@formwerk/core': patch
---

fix: negative signs affecting number parsing with date segments
2 changes: 1 addition & 1 deletion packages/core/src/useDateTimeField/useDateTimeSegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export function useDateTimeSegment(_props: Reactivify<DateTimeSegmentProps>) {

const { min, max, maxLength } = getMetadata();
const nextValue = currentInput + evt.data;
currentInput = nextValue;

const parsed = parser.parse(nextValue);
if (isNullOrUndefined(min) || isNullOrUndefined(max) || isNullOrUndefined(maxLength)) {
Expand All @@ -124,6 +123,7 @@ export function useDateTimeSegment(_props: Reactivify<DateTimeSegmentProps>) {
return;
}

currentInput = nextValue;
if (segmentEl.value) {
segmentEl.value.textContent = currentInput;
}
Expand Down

0 comments on commit c3f2be2

Please sign in to comment.