Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): prevent resetting date input when entering 0 #7415

Merged
merged 3 commits into from Feb 27, 2024

Conversation

michelheusschen
Copy link
Contributor

The date input field will reset completely when a 0 is entered anywhere. The date is considered invalid in that case and the value will be set to an empty string, causing the input to be reset. Fixed by filtering for an empty string and only setting that when focus on the input is lost.

Fixes #6621 and fixes #5673

Copy link

cloudflare-pages bot commented Feb 25, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9dc825f
Status: ✅  Deploy successful!
Preview URL: https://c8c40034.immich.pages.dev
Branch Preview URL: https://fix-web-date-input-zero.immich.pages.dev

View logs

Copy link
Contributor

@mertalev mertalev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +4 to +8
interface $$Props extends HTMLInputAttributes {
type: 'date' | 'datetime-local';
}

export let value: $$Props['value'] = undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool! Didn't know you could do this in svelte 4 already - I was excited for this in svelte 5 though haha

@alextran1502
Copy link
Contributor

Hi Michel, can you help resolve the conflict?

@alextran1502 alextran1502 enabled auto-merge (squash) February 27, 2024 02:59
@alextran1502 alextran1502 merged commit 4272b49 into main Feb 27, 2024
25 checks passed
@alextran1502 alextran1502 deleted the fix/web-date-input-zero branch February 27, 2024 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Date/Datetime - Bad Usabillity [BUG] Editing timestamp with leading 0 clears the timestamp
4 participants