Reputation: 1190
Prerequisites:
- JSF 2.1
- Primefaces 5.2
- Glassfish 3.1
Problem:
When using the following locale for my calendars, they separate the displayed date by a slash '/' instead of a dot '.'. So 1.1.2016 turns into 1/1/2016. If i remove the locale flag from my calendar, it separates with dots again.
Question:
How do i make my locale split the date with dot instead of slash?
My locale
My locale is basically the en_US locale without the messages from this website: https://github.com/primefaces/primefaces/wiki/Locales
PrimeFaces.locales ['ps'] = {
closeText: 'Close',
prevText: 'Previous',
nextText: 'Next',
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Tue', 'Fri', 'Sat'],
dayNamesMin: ['S', 'M', 'T', 'W ', 'T', 'F ', 'S'],
weekHeader: 'Week',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix:'',
timeOnlyTitle: 'Only Time',
timeText: 'Time',
hourText: 'Time',
minuteText: 'Minute',
secondText: 'Second',
currentText: 'Current Date',
ampm: false,
month: 'Month',
week: 'week',
day: 'Day',
allDayText: 'All Day',
};
Upvotes: 1
Views: 723
Reputation: 3976
In Primefaces calendar
there is an attribute called pattern
, you can use it to change the pattern of dates, for exemple <p:calendar pattern="dd.MM.yyyy HH:mm" />
this will show 12.10.2016 15:42
, you can change the pattern to separate the date however you like using dots, slach or any character. There no problem using the two attributes locale
and pattern
at the same time, it works fine for me.
Upvotes: 1