这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rolfb
Copy link

@rolfb rolfb commented Mar 13, 2014

Quick fix to make sure two digit dates < 68 is treated as dates in this century and not the last one. Includes a fix for month indexing by @SlikNL.

@rolfb
Copy link
Author

rolfb commented Mar 13, 2014

Realised I edited the build files and not the source files. Expect a fix shortly.

@amsul amsul added this to the v3.4.1 milestone Apr 2, 2014
@amsul amsul added the todo label Apr 2, 2014
@amsul
Copy link
Owner

amsul commented Apr 12, 2014

I was initially going to merge this in, but now I’m starting to reconsider. There was another PR (#75) much earlier that suggested this as well.

But I think the appropriate way to resolve is with a formatSubmit:

$( '.datepicker' ).pickadate({
    format: 'd mmmm, ‘yy',
    formatSubmit: 'yyyy-mm-dd'
});

This ensures the date will be parsed correctly :). I’ll update the docs to explicitly state this.

Cheers!

@amsul amsul added solved and removed todo labels Apr 12, 2014
@rolfb
Copy link
Author

rolfb commented Apr 12, 2014

Does this pass the tests in this pull request?—
Rolf

On Sun, Apr 13, 2014 at 12:19 AM, amsul notifications@github.com wrote:

I was initially going to merge this in, but now I’m starting to reconsider. There was another PR (#75) much earlier that suggested this as well.
But I think the appropriate way to resolve is with a formatSubmit:

$( '.datepicker' ).pickadate({
    format: 'd mmmm, ‘yy',
    formatSubmit: 'yyyy-mm-dd'
});

This ensures the date will be parsed correctly :). I’ll update the docs to explicitly state this.

Cheers!

Reply to this email directly or view it on GitHub:
#367 (comment)

@amsul
Copy link
Owner

amsul commented Apr 12, 2014

Yup, it would - so long as you also have a data-value attribute.

@rolfb
Copy link
Author

rolfb commented Apr 12, 2014

Please give the tests a run, because the issue is deeper than just date formatting.  —
Rolf

On Sun, Apr 13, 2014 at 12:34 AM, amsul notifications@github.com wrote:

Yup, it would - so long as you also have a data-value attribute.

Reply to this email directly or view it on GitHub:
#367 (comment)

amsul added a commit that referenced this pull request Apr 12, 2014
@amsul
Copy link
Owner

amsul commented Apr 12, 2014

What’s the deeper issue?

The tests are incomplete as they are.. there’s no formatSubmit specified and there’s no data-value attribute.

@rolfb
Copy link
Author

rolfb commented Apr 12, 2014

It's been a while, but if I remember correctly it doesn't parse the date correctly, and it doesn't pick the century you would assume it would. This was inspired fix by moment.js. —
Rolf

On Sun, Apr 13, 2014 at 12:44 AM, amsul notifications@github.com wrote:

What’s the deeper issue?

The tests are incomplete as they are.. there’s no formatSubmit specified and there’s no data-value attribute.

Reply to this email directly or view it on GitHub:
#367 (comment)

@amsul
Copy link
Owner

amsul commented Apr 12, 2014

Yes, it definitely wouldn’t parse correctly without a data-value attribute that doesn’t use yy.

There’s nothing wrong with the fix. It makes sense that moment.js would do that - it’s a date parsing library.

But for the purposes of a date picker, if the value you present to your user is formatted yy, you should be saving the value in your database with yyyy.

@rolfb
Copy link
Author

rolfb commented Apr 12, 2014

I agree that it should be, but our usage of the date picker doesn't save the date  anywhere as we treat is as a pass through value which is short lived and I tried setting everything as per the instructions in the manual but it didn't work. Not in front of my computer so I can't check if your configuration works for our use case yet. Thanks for following up. —
Rolf

On Sun, Apr 13, 2014 at 12:53 AM, amsul notifications@github.com wrote:

Yes, it definitely wouldn’t parse correctly without a data-value attribute that doesn’t use yy.
There’s nothing wrong with the fix. It makes sense that moment.js would do that - it’s a date parsing library.

But for the purposes of a date picker, if the value you present to your user is formatted yy, you should be saving the value in your database with yyyy.

Reply to this email directly or view it on GitHub:
#367 (comment)

@amsul
Copy link
Owner

amsul commented Apr 12, 2014

Ah, I see. Well the instructions have been updated - which will be on the live site by the end of the weekend :)

@amsul amsul closed this in 41eb682 Apr 13, 2014
@bistap
Copy link

bistap commented Mar 4, 2015

dd.mm.yy still parsing as 1900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants