diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..4b2433f7 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/android/src/main/java/com/henninghall/date_picker/Utils.java b/android/src/main/java/com/henninghall/date_picker/Utils.java index 5cf06e3f..f28976c6 100644 --- a/android/src/main/java/com/henninghall/date_picker/Utils.java +++ b/android/src/main/java/com/henninghall/date_picker/Utils.java @@ -32,7 +32,13 @@ public static Calendar isoToCalendar(String dateString, TimeZone timeZone) { if(dateString == null) return null; try { Calendar calendar = Calendar.getInstance(timeZone); - calendar.setTime(getIsoUTCFormat().parse(dateString)); + // Check if the string is a numeric timestamp (positive or negative) + if (dateString.matches("-?\\d+")) { // Matches both positive and negative numbers + long timestamp = Long.parseLong(dateString); + calendar.setTimeInMillis(timestamp); + } else { + calendar.setTime(getIsoUTCFormat().parse(dateString)); + } return calendar; } catch (ParseException e) { e.printStackTrace(); diff --git a/src/DatePickerAndroid.js b/src/DatePickerAndroid.js index a8a1e71c..a038bef4 100644 --- a/src/DatePickerAndroid.js +++ b/src/DatePickerAndroid.js @@ -96,7 +96,7 @@ const toIsoWithTimeZoneOffset = (date) => { /** @ts-ignore */ if (!date) return undefined /** @ts-ignore */ - return date.toISOString() + return date.getTime().toString() } /** @param {string} timestamp */