Skip to content

Commit 39fd130

Browse files
committed
Fix date interpreter in the sample app
1 parent 415bc79 commit 39fd130

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sample/src/main/java/com/alamkanak/weekview/sample/MainActivity.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ protected void onCreate(Bundle savedInstanceState) {
4949

5050
// Set long press listener for events.
5151
mWeekView.setEventLongPressListener(this);
52+
53+
// Set up a date time interpreter to interpret how the date and time will be formatted in
54+
// the week view. This is optional.
55+
setupDateTimeInterpreter(false);
5256
}
5357

5458

@@ -125,12 +129,12 @@ public String interpretDate(Calendar date) {
125129
// Details: http://stackoverflow.com/questions/16959502/get-one-letter-abbreviation-of-week-day-of-a-date-in-java#answer-16959657
126130
if (shortDate)
127131
weekday = String.valueOf(weekday.charAt(0));
128-
return weekday + format.format(date.getTime());
132+
return weekday.toUpperCase() + format.format(date.getTime());
129133
}
130134

131135
@Override
132136
public String interpretTime(int hour) {
133-
return hour > 11 ? (hour - 12) + "PM" : hour + "AM";
137+
return hour > 11 ? (hour - 12) + " PM" : (hour == 0 ? "12 AM" : hour + " AM");
134138
}
135139
});
136140
}

0 commit comments

Comments
 (0)