Skip to content

Commit 4198962

Browse files
committed
Merge branch 'Phoca-feature/allow-dots-in-month-and-day-pattern' into develop
2 parents 381ed51 + 9c94675 commit 4198962

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

ReadMe.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,15 @@ SwitchDateTimeDialogFragment dateTimeDialogFragment = SwitchDateTimeDialogFragme
112112
);
113113
114114
// Assign values
115-
dateTimeFragment.startAtCalendarView();
116-
dateTimeFragment.set24HoursMode(true);
117-
dateTimeFragment.setMinimumDateTime(new GregorianCalendar(2015, Calendar.JANUARY, 1).getTime());
118-
dateTimeFragment.setMaximumDateTime(new GregorianCalendar(2025, Calendar.DECEMBER, 31).getTime());
119-
dateTimeFragment.setDefaultDateTime(new GregorianCalendar(2017, Calendar.MARCH, 4, 15, 20).getTime());
120-
// Or assign each element, default element is the current moment
121-
// dateTimeFragment.setDefaultHourOfDay(15);
122-
// dateTimeFragment.setDefaultMinute(20);
123-
// dateTimeFragment.setDefaultDay(4);
124-
// dateTimeFragment.setDefaultMonth(Calendar.MARCH);
125-
// dateTimeFragment.setDefaultYear(2017);
115+
dateTimeDialogFragment.startAtCalendarView();
116+
dateTimeDialogFragment.set24HoursMode(true);
117+
dateTimeDialogFragment.setMinimumDateTime(new GregorianCalendar(2015, Calendar.JANUARY, 1).getTime());
118+
dateTimeDialogFragment.setMaximumDateTime(new GregorianCalendar(2025, Calendar.DECEMBER, 31).getTime());
119+
dateTimeDialogFragment.setDefaultDateTime(new GregorianCalendar(2017, Calendar.MARCH, 4, 15, 20).getTime());
126120
127121
// Define new day and month format
128122
try {
129-
dateTimeFragment.setSimpleDateMonthAndDayFormat(new SimpleDateFormat("dd MMMM", Locale.getDefault()));
123+
dateTimeDialogFragment.setSimpleDateMonthAndDayFormat(new SimpleDateFormat("dd MMMM", Locale.getDefault()));
130124
} catch (SwitchDateTimeDialogFragment.SimpleDateMonthAndDayFormatException e) {
131125
Log.e(TAG, e.getMessage());
132126
}

switchdatetime/src/main/java/com/kunzisoft/switchdatetime/SwitchDateTimeDialogFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public SimpleDateFormat getSimpleDateMonthAndDayFormat() {
542542
* @param simpleDateFormat Format to show month and day
543543
*/
544544
public void setSimpleDateMonthAndDayFormat(SimpleDateFormat simpleDateFormat) throws SimpleDateMonthAndDayFormatException{
545-
Pattern patternMonthAndDay = Pattern.compile("(M|w|W|D|d|F|E|u|\\s)*");
545+
Pattern patternMonthAndDay = Pattern.compile("(M|w|W|D|d|F|E|u|\\.|\\s)*");
546546
Matcher matcherMonthAndDay = patternMonthAndDay.matcher(simpleDateFormat.toPattern());
547547
if(!matcherMonthAndDay.matches()) {
548548
throw new SimpleDateMonthAndDayFormatException(simpleDateFormat.toPattern() + "isn't allowed for " + patternMonthAndDay.pattern());

0 commit comments

Comments
 (0)