Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#5051 closed bug (notabug)

Manually entered date when dateformat contains 'day name short'

Reported by: glipman Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.datepicker Version: 1.8a2
Keywords: Cc:
Blocked by: Blocking:


Ticket #3861 solves the problem 'Manually entered date does not update altField'.

In my website, the dateFormat is 'D dd-mm-yy': the date is displayed prefixed with the 'day name short'.
When the user enters a date manually, he must now unfortunately enter any valid day name, but it does not need to match the date he enters.

This is not very user friendly.

Ideally, datePicker should in a case like this ignore any invalid day or even absence of the day and onblur display the correct day name.
It can be easily tested with the following code:

    	<link type="text/css" href="themes/base/ui.all.css" rel="stylesheet" />
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" src="ui/jquery-ui.js"></script>
    	<script type="text/javascript">
    	$(function() {
    		$("#datepicker").datepicker({altField: '#alternate',
    		                             dateFormat: 'D dd-mm-yy',
    		                             altFormat: 'D dd-mm-yy'});
<p>Date: <input type="text" id="datepicker">&nbsp;
<input type="text" id="alternate" size="30"/></p>

You will see the alternate field only gets updated when you enter any valid short day name.

Change History (5)

comment:1 Changed 13 years ago by Jörn Zaefferer

Milestone: TBD1.8

comment:2 Changed 11 years ago by Jörn Zaefferer

Resolution: invalid
Status: newclosed

Why would you use that format in the first place? Asking for two formats for the same data doesn't make any sense to me. Will reopen if someone disagrees...

comment:4 Changed 11 years ago by glipman

I do not understand your reasoning. Are you questioning the dateFormat: 'D dd-mm-yy' (which is a convenient display to the end-user) or the usefulness of altFormat? Having the altFormat identical to the dateFormat does indeed not make sense but that was just for this example, in reality I have set altFormat: '@' to show a friendly date but submit the unix timestamp.

When a user enters the last day of this year he want to enter '31-12-2012', without having to calculate himself that it is a monday to be able to enter 'Mon 31-12-2012'.

comment:5 Changed 11 years ago by Scott González

But it doesn't make sense to support partial dates based on the date format. If you want to provide the additional data, then you should do so in another manner.

Note: See TracTickets for help on using tickets.