-
-
Notifications
You must be signed in to change notification settings - Fork 299
MBS-12230 / MBS-12342 / MBS-12229 / MBS-12341: Allow pasting / parsing dates on date fields #2505
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
base: master
Are you sure you want to change the base?
Conversation
7a81632
to
428ef87
Compare
8a52ecc
to
87f6338
Compare
84b777a
to
116e943
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very useful and seems to work well.
When the fields are initially loaded, or when you modify any of the year, month, or day fields, I was wondering if we should
- update the paste-a-date field with the new formatted date (in ISO format), to provide an easy way to copy existing dates, and
- enable the HTML autocomplete attribute on the paste-a-date field so that it shows a dropdown of previous dates you've entered, for quick access.
Hmm. The first one seems like a no-brainer, and I wish I would have thought of it! The second might be annoying at times, but also probably useful at times... maybe worth a shot if it's not complicated (which I guess it should not be). |
True...at least in Firefox you can delete individual autofill entries with shift+delete (on macOS).Doesn't seem to work in Chrome anymore, though... |
f42bc3d
to
96a9c19
Compare
To update the paste-a-date field with the new formatted date, I guess we would need the paste-a-date field to be part of the state, which it doesn't seem to be right now, right? Possibly a stupid question but, would that trigger a new set-date because the paste-a-date field changed? If so I guess we'd need a way to stop that to avoid silly loops. |
96a9c19
to
cb3c4d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link in this commit message is dead; after some browsing in the Internet Archive, I found that they deprecated this site as of 5/31/22. I was able to find some copies of the page earlier than that date, though. Could we maybe use an IA link instead? Such as http://web.archive.org/web/20220330023649/https://reference.discogs.com/wiki/japanese-release-dates
Sorry, that was about 5f1d632 specifically. |
cb3c4d3
to
2eeb90e
Compare
For the record, since Discogs has no sourcing for the special date formatting in question, I'm not as sure there is a need for MB to support it, especially since it's not mentioned in the current edition of RIS 204 (even as a backwards compatibility note or anything like that). I'm having a bit of trouble finding images in MB and Discogs that substantiate this formatting type being a thing, but maybe I just haven't come across the right releases yet. |
I was able to find at least one release with proof of the special Japanese date formatting; see the back cover art here. so I guess it's good to know that this was, in fact, used on real releases. I'd still like to find better standards documentation at some point, but that's definitely not blocking for this PR. |
Yes, it would need to be part of state too. |
834dff5
to
10eba6d
Compare
493036b
to
b97525e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple issues I've noted after quickly testing:
- The date parser fields are missing from the artist form.
- Entering YYYY=1999, MM=(no value), DD=09 in the date fields correctly renders
1999-??-09
in the parser field, but pasting1999-??-09
in the parser parses it as YYYY=1999, MM=09 instead of YYYY=1999, DD=09.
As a first step, this supports only YMD dates. Further options can be added in subsequent commits. The regex is based on the one from the original paste-a-date script.
We generally want to order these as year, month, day.
It's trivial to convert fullwidth numbers (and hypens) to halfwidth ones, so we might as well support this. Fullwidth support will be more useful in further commits once we add proper support for CJK dates.
This adds support for Chinese, Taiwanese, Japanese and Korean dates.
b7b5a64
to
e45a168
Compare
This makes it so that the date parser and the parsed date are kept in sync, so it is easier to edit and copy the dates.
This adds autocomplete=on to the date parser field, to allow users to reuse recently used dates more easily.
e45a168
to
17ad3cc
Compare
I made a change so that the initial date will be added to the date parser also in TT forms that use I'll look at parsing partial dates soon. |
This adds support for parsing partial dates (as in, ones without year or month). They can be entered as ????-01-01 or whatnot in the parser and that specific part of the date field will be left empty. This only works with dates in the standard YYYY-MM-DD format, with hypens or with spaces.
bc2a861
to
da54914
Compare
Partial date parsing should also work now. |
Implement MBS-12230 / MBS-12342 / MBS-12229 / MBS-12341
A mostly straightforward basic implementation of the paste-a-date concept. This first PR only supports basic straightforward cases where there is no possible clash (YYYY-MM-DD, both Western and East Asian). We can add support for other date strings that do require user choices (such as DD/MM/YYYY vs MM/DD/YYYY, where the user needs to pick what they meant for a date such as "01/02/2020") in a second PR once we know the basic concept works fine.
Testing
This adds a fair amount of tests for the parsing functions.