Uploaded image for project: 'PUBLIC - Liferay Alloy UI'
  1. PUBLIC - Liferay Alloy UI
  2. AUI-1027

Datepicker outputs incorrect values when mask contains "%b %e %m"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.x
    • Fix Version/s: 2.0.x
    • Component/s: DatePicker
    • Labels:
      None

      Description

      When the mask of an aui-datepicker which is triggered by an input text box contains "%b %e %m" and values below 10 are selected, the date which is output is incorrect. For example, if this mask is used and the 9th of October in 2013 is selected from the date picker, when the user clicks on the text box, the selected month will change to September. Other errors occur when %d and %Y are included with the mask (for example, if "%d %b %e %m %Y" is used, the year and month are changed when selecting a different day in the current month).

      Steps to reproduce:
      1. Paste this code into an .html file:

      <html>
      	<head>
      		<script src="http://cdn.alloyui.com/2.0.0pr7/aui/aui-min.js"></script>
      		<link href="http://cdn.alloyui.com/2.0.0pr7/aui-css/css/bootstrap.min.css" rel="stylesheet"></link>
      	</head>
      	<body>
      		<input id="datePicker" type="text">
      		<script type="text/javascript">
      			YUI().use(
      				'aui-datepicker',
      				function(Y) {
      					new Y.DatePicker({
      						trigger : '#datePicker',
      							mask : '%b %e %m',
      								on : {
      									selectionChange : function(event) {
      										console.log(event.newSelection)
      									}
      							}
      					});
      				}
      			);
      		</script>
      	</body>
      </html>
      

      2. Load your .html file in a browser.
      3. Click the input text box.
      4. Select a date with a day number that is less than 10 in the popup aui-datepicker.

      If the bug still exists, the month will change to the corresponding day number's month (i.e. select day 1 in the current month, the month will change to Jan; select day 2 in the current month, the month will change to Feb... etc.), and the day output will also be incorrect. If %Y is added to the mask, the year will come out incorrect as well.

        Attachments

          Activity

            People

            Assignee:
            eduardo.lundgren Eduardo Lundgren (Inactive)
            Reporter:
            kyle.stiemann Kyle Stiemann (Inactive)
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              7 years, 22 weeks ago

                Packages

                Version Package
                2.0.x