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

Date formatting - make use of @ClientCallable that returns value #64

Closed
vaadin-miki opened this issue Apr 24, 2020 · 3 comments
Closed
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@vaadin-miki
Copy link
Owner

In Vaadin 14.2 methods annotated with @ClientCallable can return value. This means that custom date formatting and parsing can be done on the server, with completely custom methods.

This probably will remove the js generator in favour of a proper method that parses and formats based on DatePattern object.

@vaadin-miki vaadin-miki added this to the Next release milestone Apr 24, 2020
@vaadin-miki vaadin-miki modified the milestones: Next release, Future Apr 29, 2020
@vaadin-miki vaadin-miki added the enhancement New feature or request label May 12, 2020
@vaadin-miki
Copy link
Owner Author

This may be more difficult than it seems, as the @ClientCallable methods return a promise, whereas formatting / parsing methods on the client assume a value instead.

vaadin-miki added a commit that referenced this issue May 26, 2020
not sure if this is a good idea
will require version bump, as it is backwards incompatible
vaadin-miki added a commit that referenced this issue May 27, 2020
does not work for basically anything else
vaadin-miki added a commit that referenced this issue May 28, 2020
there are limitations and there are too many workarounds...
@vaadin-miki
Copy link
Owner Author

issues left to fully support server-side date formatting:

  • the date picker changes its value to null before it gets back to the previous value; this happens when the overlay is opened and user clicks somewhere else than the overlay close button
  • clicking "cancel" in the overlay does not work
  • editing the date by typing it does not work

the last issue probably will never work, because of async, so in the worst case disabling the input might be the only option

@vaadin-miki
Copy link
Owner Author

closing this, as it will likely never get implemented - current DatePattern mechanism allows for most of the use cases, including month name as a localised string

if there ever comes a need for even wilder pattern generation, the existing code can be modified; point being with the current design of date picker it is not possible to fully do it server-side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant