I was not, thanks ! I'll create a Jira.
Le 20/12/2024 à 11:13, Jacques Le Roux a écrit :
Hi Florian,
I don't know if you are aware of
https://issues.apache.org/jira/browse/OFBIZ-10750 so I put it here.
At this stage, I have just read your email and have not yet a clear
opinion about.
Anyway, I think a subtask of 10750 would be welcome.
TIA
Jaques
Le 19/12/2024 à 16:26, Florian Motteau a écrit :
Hi all,
Following a request from one of our customers (who was complaining
about the date-find field), I recently implemented a new kind of form
field that uses the Date Range Picker jQuery plugin
(https://www.daterangepicker.com, I'll use "DRP" from now on). This
plugin provides a lot of flexibility when it comes to picking a date
(with or without time), or a date range. It provides a very standard
UI to do so, with a lots of options
(https://www.daterangepicker.com/#options).
I chose this plugin because it's a jQuery plugin, with a lot of
options that allows to replace both <date-find/> and <date-time/>,
and replace jQuery UI date picker (https://jqueryui.com/datepicker/)
which is far more less flexible. This plugin is quite old and is not
maintained anymore (last commit 4 years ago), but it does the job,
and is widely used (so lots of support and resources).
I also considered https://air-datepicker.com/, which is still an
active project, is written in pure JavaScript, and does not depend on
MomentJS like DRP (which is a problem, see
https://momentjs.com/docs/#/-project-status/). In fact it does not
depend on anything which is great (and pretty rare in the JS
ecosystem...). In fact, as I write, I'm thinking of giving it a shot :).
Anyway.
At first I tried to modify the date-find field, in such a way that it
could support the classic UI, or the DRP UI (basically, something
that would look like <date-find
input-method="classic|dateRangePicker">). After all, why would I
introduce another date picker field in OFBiz ?
After a few hours messing around with macros and the Java form
builder, it appeared that it would add a lot of complexity to build a
single field capable of displaying the standard date picker or the
new one (supporting all of the features that DRP offers). I also
thought that, for our use case, it could be pretty handy to keep the
standard date picker as it is. Also, DRP has at least one limitation
compared to the standard : OOTB you cannot search entities where a
date field is empty (but it could be implemented on top of it).
So I finally chose to write a new field, <date-range-picker/>, which
supports almost all the options that DRP offers (as field's
attributes). It is really a wrapper around DRP, more than a generic
date picker field. It can be used to pick only one date (like
<date-time/>), or a range (like <date-find/>, you can choose to pick
time or not, and many other things showcased here :
https://www.daterangepicker.com/#examples. In our use case, we plan
to use it on a few critical forms (the ones that our client
complained about), and keep the <date-find/> everywhere else. If
everything goes fine, we will eventually extend its usage.
So my question would be : do you feel that a new date/date-range
picker field, with a more fancy UI, would be an interesting addition
to the common theme in OFBiz ? Would you have any suggestion about
that ? If we go forward, do you have an opinion about wether I should
choose DRP or Air Picker (the method would be the same : implement
every option that the plugin offers as OFBiz field attributes) ?
Thanks for your time!
Florian
--
Néréide <http://nereide.fr/>
Florian Motteau
Co-entrepreneur Néréide
informat...@nereide.fr
8 rue des Déportés 37000 TOURS
Std: 02 47 50 30 54
www.nereide.fr <https://nereide.fr/>
Réseau Libre-Entreprise <https://www.libre-entreprise.org/>