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

#19 add support from a and p keys to change day period #20

Merged
merged 4 commits into from
Jul 19, 2024
Merged

#19 add support from a and p keys to change day period #20

merged 4 commits into from
Jul 19, 2024

Conversation

LiniovasDovydas
Copy link
Contributor

Closes #19

Could not check if it works in storybook due to errors, maybe because I am on windows, but tests seem to run fine, if you could check I'd be grateful 🙂.

PS C:\other\timescape> pnpm demo

> @timescape/[email protected] demo C:\other\timescape
> pnpm --filter demo run dev


> [email protected] dev C:\other\timescape\packages\demo
> concurrently -n 'integration,storybook' 'pnpm vite --port 4949' 'pnpm storybook:dev --no-open'

['integration] ''pnpm' is not recognized as an internal or external command,
['integration] operable program or batch file.
[2] ''pnpm' is not recognized as an internal or external command,
[2] operable program or batch file.
[2] 'pnpm exited with code 1
['integration] 'pnpm exited with code 1
[3] The filename, directory name, or volume label syntax is incorrect.
[3] storybook:dev exited with code 1

Copy link

changeset-bot bot commented Jul 19, 2024

⚠️ No Changeset found

Latest commit: 4bff788

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dan-lee
Copy link
Owner

dan-lee commented Jul 19, 2024

Hey @LiniovasDovydas,
thank you so much for reporting this issue and also sending a PR :)
That's definitely an oversight, I'll take a look asap!

Also sidenote:

Interesting that pnpm works when you call it yourself, but not when called from concurrently. Perhaps you could try running both commands in separate terminals in packages/demo:

pnpm vite --port 4949
pnpm storybook:dev --no-open

Copy link
Owner

@dan-lee dan-lee left a comment

Choose a reason for hiding this comment

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

This is a good fix, thanks for contributing! 🚀
I also snuck in a fix that prevents any other characters from being typed into this field

In the longer term, I wonder if there's a way where we could provide a similar experience to what a <select> field gives on a mobile browser, like so:

image

@dan-lee dan-lee merged commit 482d067 into dan-lee:main Jul 19, 2024
@dan-lee
Copy link
Owner

dan-lee commented Jul 19, 2024

@LiniovasDovydas
Copy link
Contributor Author

LiniovasDovydas commented Jul 19, 2024

Nice! After creating the PR I thought about the preventing characters case, but you beat me to it 😄.

Regarding the <select /> the only issue I see is that the web options are not stylable yet. The package could export utility to switch to AM/PM and handle the switch, while the UI is left for the user to create, while the default getInputProps() could work with the <select /> element.

const { setDayPeriod } = useTimescape({ ... })

setDayPeriod('AM');
setDayPeriod('PM');

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.

Issue. Mobile AM/PM segment can't be changed
2 participants