TheCoder4eu / BootsFaces-OSP

BootsFaces - Open Source Project
Apache License 2.0
246 stars 102 forks source link

dateTimePicker min/maxDate types are not all supported or wrongly documented #1020

Open jepsar opened 5 years ago

jepsar commented 5 years ago

See https://stackoverflow.com/questions/52863344/bootsfaces-typeerror-mindate-could-not-parse-date-parameter

geopossachs commented 5 years ago

This will be work:

<b:dateTimePicker value="startdate" required="true" minDate="now" colMd="one-fourth" labelColMd="1" label="Start" format="DD-MM-YYYY" />

the datepicker comes, i belive, from https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js and has the fix string now inside or parse the string with moment.js (The secound fix keyword moment will not work 👎 )

When creating a moment from a string, we first check if the string matches known ISO 8601 formats, we then check if the string matches the RFC 2822 Date time format before dropping to the fall back of new Date(string) if a known format is not found. https://momentjs.com/docs/#/parsing/

This will be not work:


<b:dateTimePicker value="startdate" required="true" minDate="#{now}" colMd="one-fourth" labelColMd="1" label="Start" format="DD-MM-YYYY" />
``
-> the Java EL convert {#now} on server side before with a _wrong_ format
stephanrauh commented 5 years ago

I've dropped #{now} because it collides with a bean with the same name in OmniFaces (and their #{now} is both documented and configurable).

geopossachs commented 4 years ago

It works with .toInstant().toString() or with moment.js strings

                <b:dateTimePicker value="startdate" required="true" colMd="one-fourth" labelColMd="1" label="Start" format="DD-MM-YYYY" >
                    <!-- <f:attribute name="minDate" value="moment(#{session.lastAccessedTime})"/> -->
                    <!-- <f:attribute name="minDate" value="moment()"/> -->
                    <!-- <f:attribute name="minDate" value="now"/> -->
                    <f:attribute name="minDate" value="#{pageBean.currentDate.toInstant().toString()}" /> 
                </b:dateTimePicker>

i add support for Date()

geopossachs commented 4 years ago

@stephanrauh do we realy support java7 and lower or can i use java8 in my solutions

geopossachs commented 4 years ago

@stephanrauh I has changed in the tag lib the type to object but it also set a string. Do I something wrong or miss something?

I have closed the PR #1136 and move the issue to version 1.6. Can you create a milestone 1.6 and milestone 1.7 for me?

stephanrauh commented 4 years ago

@TheCoder4eu Would you mind to create a milestone 1.6?