-
Notifications
You must be signed in to change notification settings - Fork 353
Conversation
Thank you! (Edited) I wasn't aware that support for Do you happen to know how we display and edit dates in the currently active locale? (which is en-US right now, but I'll definitely add support for more locales in the future) Such as "mm/dd/yyyy" or "dd. mm. yyyy". This is what browsers with support for That has been requested by some users an I want to get that done together with localization. That doesn't seem to be so easy with predefined masks, sadly. |
Yea localization stuff #123 occurred to me while writing this. I think I can sort it out... |
Maybe the stuff over here is useful for this. https://ng-bootstrap.github.io/#/components/datepicker/overview#date-model |
Oof, yea this got ugly fast. I mean it works but Im not happy with it. I made it a separate branch but its really doing my head in. https://github.com/shamoon/paperless-ng/tree/feature-date-picker-i18n The date picker is trivial to change it just works once you set the locale of the app (
|
I know its a holiday, sorry for all the messages but please take your time to reply =) Just wanted to add that I think the above branch ( https://github.com/shamoon/paperless-ng/tree/feature-date-picker-i18n ) isnt actually so bad, just perhaps could use your feedback on the approach. To explain a little more, there are three basic places we would need to internationalize to make this new component work:
In an effort to keep things DRY I put the above in Pipes, which is probably not the right approach for all 3 but at least as a proof of concept it works. See https://github.com/shamoon/paperless-ng/blob/feature-date-picker-i18n/src-ui/src/app/components/common/input/date-time/date-time.component.ts for reference. |
Hey @jonaswinkler I know this has been bumped for a while but I was circling back around to it and I think with the date formatting in the app now this is worth looking at again. I merged the Take a look and tell me what you think. One issue with the code as it is now is I really didn't know the best place to put the functions for getting the formatted mask and placeholder as well as one function that "de-transforms" a localized string, in other words if someone types |
Finally looking into this again.
|
Yea it’s been a while so I’d have to dig in again. I think the issue was building an adapter between the mask and date input. |
Ps. Thanks for circling back to stuff, I do realize you’ve been very busy with squashing bugs and structural changes (not to mention, ya know, life!) |
…ing to the current locale #177
Well...
This issue here has been on my list for very long, I just didn't had the motivation to dig into this ng-bootstrap date picker. I think I've got this sorted out, so I'll be closing this. Regarding masking: not sure if this is exactly needed. The backend will reject invalid dates and the front end will show an error on invalid input. |
Eh, ok your call of course. IMHO errors after submitting are not as good as just making sure the input is correct. Not all browsers will validate and keyboard input is basically unrestricted. Which is why I was trying to implement masking. But yea... |
Oh, my bad. Should have phrased that a little better. I was not implying that it's not useful! I just that the |
Sure I’ll play with it in next release, I’m sure it’ll be an improvement over current. I’ll just think of my time on this branch as experimentation 😄 |
Wasting people's time always feels bad :( At least I can salvage the css for the dark mode calendar, that's something. |
Oh no worries really, thanks. I should just be more patient about waiting for an actual agreed plan. Regardless still fun to work on! dark mode calendar css FTW 😄 |
New version's on the way, let me know what you think about the date input. |
This is a major major improvement! As usual, great work. I do think the mask had some niceness about formatting keyboard input but honestly probably not worth it considering how much cleaner this is. Bravo 👏🏼 |
Hey so I know we had issues with using the ngbDatepicker but unfortunately browser support for the plain HTML5
<input type="date">
is abysmal, see: http://www.iwanttouse.com/#input-datetime / https://caniuse.com/input-datetime. In my case, my primary browser is Safari on macOS and the date is just a plain text field which makes editing it even with keyboard entry very slow and unpleasant. This was frustrating me on the document detail page which is why I started this but then I decided to include the filter editor drop downs as well. For the dropdown I discovered some usability issues for example, since theres (currently, anyway) no form validation you can type in anything in safari which results in malformed API requests.So, there were a few other options I looked at but what I ended up settling on was using a masking package ngx-mask and bringing back the NgbDatePicker (this time with no hacks or issues 🙂). I kinda think its the "best of both worlds".
This PR includes:
YYYY-MM-DD
Of course, welcome your feedback.
Edit: video
p-ng_date.mov