Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae5be9ee authored by Nihar Thakkar's avatar Nihar Thakkar Committed by Jochen Sprickerhof
Browse files

Import event with default time zone if parsing time zone fails

parent 10af905b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -841,6 +841,7 @@
    <string name="cal_import_menu_title">Import event</string>
    <string name="cal_nothing_to_import">Nothing to import</string>
    <string name="cal_import_error_msg">Importing to calendar failed</string>
    <string name="cal_import_error_time_zone_msg">Unable to understand given time zone: %s</string>
    <string name="cal_import_error_date_msg">Unable to understand given date: %s</string>
    <string name="cal_pick_ics">Pick file to import</string>

+8 −5
Original line number Diff line number Diff line
@@ -64,13 +64,16 @@ public class ImportActivity extends Activity {
            // (which are quite a lot, see e.g. http://tutorials.jenkov.com/java-date-time/java-util-timezone.html)
            if (Arrays.asList(TimeZone.getAvailableIDs()).contains(timeZone)) {
                format.setTimeZone(TimeZone.getTimeZone(timeZone));
            }
            else {
                format.setTimeZone(TimeZone.getDefault());
                Toast.makeText(this, getString(R.string.cal_import_error_time_zone_msg, timeZone), Toast.LENGTH_SHORT).show();
            }
            try {
                format.parse(iCalDate);
                    format.setTimeZone(TimeZone.getDefault());
                return format.getCalendar().getTimeInMillis();
            } catch (ParseException e) {  }
        }
        }

        // ONLY DATE, e.g. 20190415
        else if (iCalDateParam != null && iCalDateParam.equals("VALUE=DATE")) {