Problem with calendarpicker

General issues related to the use of Metro 4
Post Reply
Freaky_
Posts: 3
Joined: Tue Sep 25, 2018 12:08 am
Status: Offline

Problem with calendarpicker

Post by Freaky_ » Tue Sep 25, 2018 12:11 am

Hello guys,

I have problem with my calendarpickers. They don't showing date until I select them. Previously they show current date and there was no problem with them.

But from today, my whole code stopped working, because calendarpicker not showing current date, and after select any date - it returns nothing.
Problem exist even on official Metro4 website: Calendarpicker

The pool shows nothing, blank.

Anyone could help?

User avatar
olton
Site Admin
Posts: 114
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Tue Sep 25, 2018 12:40 am

Use value attribute to set init date value for picker

Freaky_
Posts: 3
Joined: Tue Sep 25, 2018 12:08 am
Status: Offline

Post by Freaky_ » Tue Sep 25, 2018 9:09 am

The problem is, when I pick another date it returns "undefined".

<input type="text" data-role="calendarpicker" data-format="%e %B %Y" data-on-change="onChange">

function onChange(val, nDate, el)
{
alert(nDate); // Undefined every time
}


It was working before, but stopped suddenly.

User avatar
olton
Site Admin
Posts: 114
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Tue Sep 25, 2018 9:17 am

Code: Select all

Utils.exec(o.onChange, [that.value], element[0]);
Now event on change receive one argument value and have context input html element

Freaky_
Posts: 3
Joined: Tue Sep 25, 2018 12:08 am
Status: Offline

Post by Freaky_ » Tue Sep 25, 2018 9:28 am

Okay, this working perfectly.

var value = $("#datapicker").val();

Thanks for your help!

User avatar
olton
Site Admin
Posts: 114
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Tue Sep 25, 2018 12:08 pm

In 4.2.24
+ [x] Calendar picker: add attribute `data-null-value`. If this attribute false and value empty, used current date

Post Reply