mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(datetime): ensure year-only values are not affected by timezone when parsing (#21309)
This commit is contained in:
@ -262,13 +262,14 @@ export const getDateTime = (dateString: any = '', timeZone: any = ''): Date => {
|
||||
|
||||
/**
|
||||
* Ensures that YYYY-MM-DD, YYYY-MM,
|
||||
* YYYY-DD, etc does not get affected
|
||||
* YYYY-DD, YYYY, etc does not get affected
|
||||
* by timezones and stays on the day/month
|
||||
* that the user provided
|
||||
*/
|
||||
if (
|
||||
dateString.length === 10 ||
|
||||
dateString.length === 7
|
||||
dateString.length === 7 ||
|
||||
dateString.length === 4
|
||||
) {
|
||||
dateString += ' ';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user