Is there a way to highlight specific months in reat-datepicker Month picker? - highlight

I'm trying to highlight specific months in showMonthYearPicker, just like in the default datepicker. I tried few options, none work. Can someone help to figure out a way to do that?
<DatePicker
selected={startDate}
onChange={(date) => setStartDate(date)}
highlightDates={[addDays(new Date(), 31)]}
showMonthYearPicker
/>
or even:
<DatePicker
selected={startDate}
onChange={(date) => setStartDate(date)}
highlightMonths={[addDays(new Date(), 31)]}
showMonthYearPicker
/>
for example, the desired result would look like that:

Related

Syntax - How to combine Binding with Localization?

I need to combine localization with binding. I have the following xml:
<Label Text="{Binding TravelOrder.StartDate, StringFormat='Start Date: {0:d}'}" />
I would like to have the string format localized, i.e. instead of "Start Date" to have, for instance, for French, "Date de debut".
How can I put something like {x:Static res:AppRes.StartDate} inside my StringFormat value ?
I have tried to write something like
Text="{Binding TravelOrder.StartDate, StringFormat='{x:Static res:AppRes.StartDate}: {0:d}'}" />
but clearly that doesn't work.
Thank you.

mobile jquery datepicker with only date and month

I want a jquery mobile Datepicker that will allw only date and month selection not year
I am using the below plugin given on link
Visit http://demos.jquerymobile.com/1.0a4.1/experiments/ui-datepicker/
can anybody help me out to format it accoring to my need
I would use DateBox ( http://dev.jtsage.com/jQM-DateBox/ ) which has many options for customization. To setup a month and day only picker, you can use either the 'datebox' or 'flipbox' modes:
<input name="Date1" id="Date1" type="date" data-role="datebox" data-options='{"mode":"datebox", "overrideHeaderFormat": "%B - %d", "overrideDateFormat": "%B - %d", "overrideDateFieldOrder": ["m", "d"]}'}'' />
<input name="Date2" id="Date2" type="date" data-role="datebox" data-options='{"mode":"flipbox", "overrideHeaderFormat": "%B - %d", "overrideDateFormat": "%B - %d", "overrideDateFieldOrder": ["m", "d"]}'}'' />
You use the override formats to present month and day. %b is the 3 letter abbreviation for month, %B is full month name. If you prefer a number, use %m.
Here is a DEMO
For more info on DateBox, see the many Demos at the site

PrimeFaces locale not working

I am using PrimeFaces Calendar component . But I want to display time and month in Turkish.I have written codes like this;
< p:calendar effect="slideDown" navigator="true" locale="tr"
yearRange="1975" pattern="dd/mm/yyyy HH:mm"/>
But it is displaying again in English.What is the problem?
Primefaces itself only provides english translations for localizable components like calendar. If you need other translations you have to include them manually into your JSF via JavaScript.
Add the following JavaScript to your JSF view:
<script type="text/javascript">
PrimeFaces.locales['tr'] = {
closeText: 'kapat',
prevText: 'geri',
nextText: 'ileri',
currentText: 'bugün',
monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz', 'Tem','Ağu','Eyl','Eki','Kas','Ara'],
dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
weekHeader: 'Hf',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: '',
timeOnlyTitle: 'Zaman Seçiniz',
timeText: 'Zaman',
hourText: 'Saat',
minuteText: 'Dakika',
secondText: 'Saniye',
ampm: false,
month: 'Ay',
week: 'Hafta',
day: 'Gün',
allDayText : 'Tüm Gün'
};
</script>
See also:
http://code.google.com/p/primefaces/wiki/PrimeFacesLocales
EDIT:
PrimeFaces moved to github, so here is the new URL (even though the old one is still available up to now):
https://github.com/primefaces/primefaces/wiki/Locales
Create a file primefaces_i18n.js inside your resources/js folder.
Copy and paste this gist inside it.
Then you can import it in your page like this:
<h:outputScript library="js" name="primefaces_i18n.js" />
Periodically check PrimeFacesLocales for translation updates

POST value of date picked in YUI calendar

I've been looking every where, and the tutorial doesn't seem to work when I use it. I saw something like getfullmonth, getfullyears etc. ... anyway, I'm using this code:
My js:
<script>
YAHOO.namespace("example.calendar");
YAHOO.example.calendar.init = function() {
YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","cal1Container", {PAGES:1});
YAHOO.example.calendar.cal1.render();
}
YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
</script>
And this is my HTML:
<input type="text" value="I WANT TO PUT THE SELECTED DATE HERE" id="datechoix" class="n-input2" name="datechoix" readonly="readonly" />
<div id="cal1Container" style="margin-top:15px;"></div>
Anyone got a good tutorial or a complete answer maybe?
You have to listen to the select-date-event. It fires if a user selects a date and holds the date information as arguments.
See this example:
http://yui.github.io/yui2/docs/yui_2.9.0_full/examples/button/btn_example09.html

how to render selected date when I select date from calendar using primefaces?

Selected date should be displayed in outputText when I select date from calendar control of primefaces. I have written code for this but not worked.
<p:calendar mode="popup" showOn="both" mindate="15-06-2012" pattern="dd-MM-yyyy" effect="fadeIn">
<p:ajax event="keyup" update="out1"/>
</p:calendar><br/><br/><hr/>
<h:outputText id="out1" value="#{sampleBean.selectedDate}"/>
From your question what i understand is that you want to show the date in ouput which you selected.
for this in your
<p:calendar..... code
add a statement of
value="#{sampleBean.selectedDate}" update=":out1"
This way the selected value will be saved in the selectedDate attribute of your sampleBean.
<h:outputText id="out1" value="#{sampleBean.selectedDate}"/>
Well, I'm not sure what you are trying to accomplish but the value returned from the calendar goes to the "value" tag wich is missing, why can't you simply use something like:
<p:calendar value="#{sampleBean.selectedDate}" id="calId" mode="popup" showOn="both" mindate="15-06-2012" pattern="dd-MM-yyyy" effect="fadeIn" />
This should (according to docs and Showcase) should render n input with the calendar just fine...

Resources