b-b-a / bba-power

1 stars 0 forks source link

Client Edit - new LOA doc - warning about date #214

Closed ghost closed 11 years ago

ghost commented 11 years ago

Can you check the logic that causes the "Are you sure the LoA Expiry Date you entered is correct" message please. It seemed to come up even though I had set the date. The message should be displayed if the date is not changed when a new doc. up uploaded. If the date is changed then we assume the user put the correct one in, if the date was not changed the chances are that the user forgot - a new document should mean a new date!

shaunfreeman commented 11 years ago

seems to do this for me. the warning seems to come up only when the date has not changed and a new document is uploaded.

when i change the date and don't upload a document, no warning comes up.

Is this correct?

ghost commented 11 years ago

I am getting the "are you sure messgae" every time. I select a document and set a new date (121212) and it shows. Aaaah but not if I use a date like 13/9/12.

shaunfreeman commented 11 years ago

The JavaScript date validate works differently, as this is a soft error I have to use JavaScript to do the validate before the form is sent, unless we make a call to the server via Ajax to validate this date first using Zend_Form as with all the other dates.

At the moment I don't know if JavaScript Date will do this without processing extra logic.

Actually I really don't like the lazy date method I would prefer a hard error on dates in English format only (dd/mm/yyyy).

Are users putting dates in without slashes or dots (dd/mm/yyyy or (dd.mm.yyyy)?

ghost commented 11 years ago

I am afraid they are using 121212. It is allowed in some places so the person that is forever putting in dates on the usage screen does. My suggestion is to not validate in JS but go back to the server for this sort of thing. (Ajax to validate this date first using Zend_Form as with all the other dates) - do - I like consistency - if we change the date handling it will be done everywhere in one go!

ghost commented 11 years ago

I am still getting the "are you sure message" every time. I select a document and set a new date (111111) and it shows but not if I use a date like 13/9/12. Aaah - being real lazy - date 111111 is doing the above ; something like 141213 is fine.

shaunfreeman commented 11 years ago

can the date be set by user to an date before the current date as my logic was 'newDate < oldDate = fail' But should it be 'newDate != oldDate = fail' or 'newDate < oldDate || newDate != oldDate = fail'

or am I complicating it?

shaunfreeman commented 11 years ago

As far as I can test this is now working to show if: newDate is not a newer date than the oldDate:

newDate 01/01/12 and oldDate 01/01/13 will fail newDate 01/01/12 and oldDate 01/01/12 will fail newDate 01/01/12 and oldDate 01/01/11 will pass