Micusoft / mobiscroll

Automatically exported from code.google.com/p/mobiscroll
0 stars 0 forks source link

init datescroller with value of inputfield not working #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a datescroller, f.ex:
  $('#date1').scroller({
    preset: 'date',
    dateFormat : 'dd.mm.yyyy',
  });
2. ... and an input field with a predefined value:
  <input type="text" name="date1" id="date1" value="01.01.2011" />

What is the expected output? What do you see instead?

When clicking into the input field, the scroller inits with the current date, 
not with that from the value of the input field.

What version of the product are you using? On what operating system?
v1.5.1 @ ubuntu 10.10 Firefox 3.6.26

Please provide any additional information below.

I attached a sample with a workaround for this special scenario.
Somehow the exception 'Missing number at position x' is thrown.
In function parseDate, inline function getNumber before returning a value, I 
added:
if(size == 4) iFormat += 2;

Original issue reported on code.google.com by markusst...@gmail.com on 14 Oct 2011 at 11:09

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by diosla...@gmail.com on 17 Oct 2011 at 5:55

GoogleCodeExporter commented 8 years ago
Well... it does not appear in the documentation, but you must use 'yy' for 4 
digit, and 'y' for 2 digit year format in your dateFormat option, like in the 
jquery UI datepicker. In your case change 'dd.mm.yyyy' to 'dd.mm.yy' and your 
problem is gone.

Original comment by diosla...@gmail.com on 17 Oct 2011 at 8:31

GoogleCodeExporter commented 8 years ago
Ah ok, thanks for the hint!

(Seems to be added to the documentation now.)

Original comment by markusst...@gmail.com on 18 Oct 2011 at 8:04