Tagged: datepicker
- This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by
Steve.
-
AuthorPosts
-
-
January 5, 2016 at 10:34 am #5481
vayuMemberHi.
I have a datepicker field. When I create a new post, the default value is 01. January, 1970. I need for it to be empty, also when I save the post. I tried to add this to the field options:'options' => array( 'dateFormat' => 'd-m-yy', 'setDate' => null )and value to empty. Is there something else I could do to have an empty value in the datepicker field?
-
January 5, 2016 at 5:42 pm #5487
SteveKeymasterhave you tried:
'value' => null
This does not go in the
optionsarray. -
January 5, 2016 at 5:47 pm #5488
vayuMemberThanks Steve, but I had already tried this.
This is my code:
piklist( 'field', array( 'type' => 'datepicker', 'scope' => 'post_meta', 'field' => 'invoice_approved_date', 'value' => null, 'label' => 'Dato godkendt', 'attributes' => array( 'class' => 'select invoice-approved-date', 'placeholder' => 'Dato godkendt', ), 'options' => array( 'dateFormat' => 'd-m-yy', 'firstDay' => 1, 'closeText' => 'Luk', 'prevText' => 'Forrige', 'nextText' => 'Næste', 'monthNames' => ['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'], 'monthNamesShort' => ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'], 'dayNames' => ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], 'dayNamesShort' => ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], 'dayNamesMin' => ['Sø','Ma','Ti','On','To','Fr','Lø'], 'weekHeader' => 'Uge', 'isRTL' => false, 'showMonthAfterYear' => false, 'yearSuffix' => '' ) ) ); -
January 5, 2016 at 5:58 pm #5491
SteveKeymasterYour code is working for me with Piklist v0.9.9.7.
-
January 5, 2016 at 6:32 pm #5494
vayuMemberOkay, thanks for checking. I have the same piklist version, but it’s not working for me.
-
January 5, 2016 at 10:46 pm #5499
-
January 6, 2016 at 4:58 am #5504
vayuMemberThanks again for helping me out! I found the cause for my problem, and it’s because I had added this code:
https://piklist.com/support/topic/advice-for-sorting-by-date-with-date-picker/#post-4640, which by default does not let me use an empty value.
I do apologise for having wasted your time, but your help got me on the right track.
Thanks again! -
January 6, 2016 at 3:00 pm #5507
SteveKeymasterMy pleasure!
Glad it’s working fine.
-
-
AuthorPosts
- The topic ‘datepicker field has default 01. January, 1970’ is closed to new replies.