You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The date does not change when mode "dateAndTime" is used (and there is an initial date in options)
in DatePickerPlugin.java, on completion of the DatePickerDialog, if mode is dateAndTime, the routine 'launchTime()' is called.
The first thing launchTime does is:
if (pickerDate != null) {
calendar.setTime(parseDateFromString(pickerDate));
}
This sets the time from the pickerDate variable, which is the input date to the whole component, hence ignoring any changes that might have been made by the DatePickerDialog. The same logic is repeated a bit further down in the same function.
If changed to:
if (pickerMode.equals("time") && (pickerDate != null)) {
calendar.setTime(parseDateFromString(pickerDate));
}
Hi,
Yes it is. It is the transition between the date picker and time picker
that the issue occurs, the time picker takes the original input date which
overwrites any change made in the date picker
Regards,
Steve
Steve Allam | Director | Imhotek UK Ltd
Mob: 07976 522793
Shamelessly advertising my son's T-shirts at: shop.boldpen.uk
On 18 April 2021 00:06:33 Daniel Pereira ***@***.***> wrote:
Is this only in dateAndTime mode?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Describe the bug
The date does not change when mode "dateAndTime" is used (and there is an initial date in options)
in DatePickerPlugin.java, on completion of the DatePickerDialog, if mode is dateAndTime, the routine 'launchTime()' is called.
The first thing launchTime does is:
This sets the time from the pickerDate variable, which is the input date to the whole component, hence ignoring any changes that might have been made by the DatePickerDialog. The same logic is repeated a bit further down in the same function.
If changed to:
if (pickerMode.equals("time") && (pickerDate != null)) {
calendar.setTime(parseDateFromString(pickerDate));
}
Then all is ok.
To Reproduce
Steps to reproduce the behavior:
var opts:DatePickerOptions = { date: "2021-04-17T20:00", mode: "dateAndTime", format:"yyyy-MM-dd'T'HH:mm", theme: "light", is24h: true };
DatePicker.present(opts).then((res) =>
{
console.log('date result'+JSON.stringify(res));
});
Expected behavior
The date to change!
Additional context
"@capacitor-community/date-picker": "^0.2.3",
"@capacitor/android": "^2.4.7",
"@capacitor/cli": "^2.4.7",
"@capacitor/core": "^2.4.7",
"@ionic-native/core": "^5.32.0",
The text was updated successfully, but these errors were encountered: