capacitor-community / capacitor-community/date-picker
bug: "Failed to parse date" on iOS when providing min and max values
- Dominant language
- Swift
- Stars
- 94
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I provide values for the min and max values, the date and time picker does not show up on iOS. The same typescript code works perfectly well on Android.
**To Reproduce**
Steps to reproduce the behavior:
1. On iOS, tap the "Select Date and Time" button

2. The following "Failed to parse date" error shows up

**Expected behavior**
The date picker should open instead, honoring the min and max dates provided upon instantiation.
**Smartphone (please complete the following information):**
- Device: iPhone X
- OS: iOS 14.4.2
**Additional context**
```typescript
// Note that minDate is shown in the template itself
get minDate(): string {
return DateTime.now().plus({ hours: 2 }).toFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
}
get maxDate(): string {
return DateTime.now().plus({ days: 6 }).toFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
}
...
async showPicker() {
const DatePicker: DatePickerPluginInterface = Plugins.DatePickerPlugin as any;
const options = {
min: this.minDate,
max: this.maxDate,
};
DatePicker.present(options).then(
(date) => (this.currentArrivalDateTime = date.value),
(err) => alert(err)
);
}
```
```html
{{ minDate }}
Preferred Arrival Time
{{ currentArrivalDateTime | date: "EEE - MMM d (h:mm a)" }}
Change
Select Time and Date
```
The same exact code works on Android. See screenshots below.



Contributor guide
Research direction
Reproduce the issue on iOS using the min and max date strings shown in the report, then inspect the plugin's iOS date-parsing path. Done means the picker opens with those bounds honored and the existing Android behavior remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift, typescript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100