Skip to main content

Search and Top Navigation

#5051 closed bug (notabug)

Opened January 07, 2010 11:36PM UTC

Closed February 27, 2012 02:09PM UTC

Last modified February 27, 2012 05:34PM UTC

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:
Description

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:

<html>
    <head>
    	<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'});
    	});
    	</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"> 
<input type="text" id="alternate" size="30"/></p>
</body>
</html>

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

Attachments (0)
Change History (5)

Changed January 15, 2010 12:15PM UTC by jzaefferer comment:1

milestone: TBD1.8

Changed February 27, 2012 02:09PM UTC by jzaefferer comment:2

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...

Changed February 27, 2012 02:09PM UTC by jzaefferer comment:3

Changed February 27, 2012 05:26PM UTC by glipman comment:4

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'.

Changed February 27, 2012 05:34PM UTC by scottgonzalez comment:5

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.