question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DatePicker - Allow setting view date

See original GitHub issue

Please enable a property to set the view date for a p:datePicker

Current hack is very ugly.

<p:datePicker id="salaryDepositsCalendar" widgetVar="salaryDepositsCalendar" inline="true" numberOfMonths="4" selectionMode="multiple" value="#{cc.attrs.data.affobj.depositDates}"
					maxdate="#{utils:dateNow()}" maxDateCount="#{cc.attrs.data.affobj.numberOfDeposits}" />

<h:outputScript>
	var t = PF('salaryDepositsCalendar');
	var tt = t.jq.datePicker();
	var ttt = tt.data();
	ttt.primeDatePicker.viewDate = new Date('#{cc.attrs.data.affobj.getLastDepositDate()}');

//Literally just to render the view because .refresh() doesn't work (so click the previous button to force it)
$('[id$="salaryDepositsCalendar"] .ui-datepicker-prev').click();
</h:outputScript>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, Jul 11, 2019

PR Submitted. if you need that functionality right now just add this JS to your own JS file.

PrimeFaces.widget.DatePicker.prototype.setViewDate= function(date) {
  this.jq.datePicker('updateViewDate', null, date);
}
0reactions
GedMarccommented, Jul 12, 2019

Beautiful! ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap datetimepicker: set view only date, day not ...
You can try setting date like this: $("#datePicker") .datepicker({ format: "mm/dd/yyyy", autoclose: true }); ...
Read more >
Options — bootstrap-datepicker documentation - Read the Docs
Date to view when initially opening the calendar. The internal value of the date remains today as default, but when the datepicker is...
Read more >
Datepicker Widget - jQuery UI API Documentation
The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality ... Set all date pickers to open on focus or...
Read more >
How to set date display format for jQuery datepicker?
Expand the section labeled, "MORE SETTINGS AND VALUES", then select the desired date format from the "Date entry options" select list.
Read more >
Change how a date or time is displayed in a date picker, text ...
To format the control to show both the date and time, select the display style that you want for the date in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found