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

[Feature request] Add more formats for the input #24

Closed
Foxeye-Rinx opened this issue Sep 5, 2022 · 5 comments · Fixed by #91
Closed

[Feature request] Add more formats for the input #24

Foxeye-Rinx opened this issue Sep 5, 2022 · 5 comments · Fixed by #91

Comments

@Foxeye-Rinx
Copy link

Foxeye-Rinx commented Sep 5, 2022

Hi, thank for the lovely library. I love it so much. Is there any way to add more formats for the input?

image

I got that format on the moment's doc

@probablykasper
Copy link
Owner

Would happily accept a PR for it

@Razunter
Copy link

Also there is currently no support for single digit hours, only two digits.

Wtower added a commit to Wtower/date-picker-svelte that referenced this issue Jun 23, 2023
@Wtower
Copy link

Wtower commented Jun 24, 2023

I added several options in parse.ts, but this does not seem to work: When entering any value, the date picker presents the format as value. For example, if I specify as format d/M/yy, it displays this exact format rather than the value.

I am not familiar with the code of this component and have a trouble understanding its logic. If someone can point me to some direction that would be great, otherwise it is a dead end for my attempt to solve this.

@probablykasper
Copy link
Owner

There's two parts to it, createFormat() which parses the format into FormatToken[], and parse() which parses dates using the FormatToken[]s.

I'm not sure how variable-length format tokens should be handled. How would yymd parse 23111 - 23-11-1 or 23-1-11?

@probablykasper
Copy link
Owner

About the parsing of yymd, I'd be ok with calling it undefined behavior and parsing it however is easiest (which is probably 23111 -> 23-11-1)

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 a pull request may close this issue.

4 participants