mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 22:17:40 +08:00
fix(datetime): default to current date when value is null (#18105)
fixes #18099
This commit is contained in:
@ -248,6 +248,17 @@ export function parseDate(val: string | undefined | null): DatetimeData | undefi
|
||||
* such as "01:47"
|
||||
*/
|
||||
export const getLocalDateTime = (dateString: any = ''): Date => {
|
||||
/**
|
||||
* If user passed in undefined
|
||||
* or null, convert it to the
|
||||
* empty string since the rest
|
||||
* of this functions expects
|
||||
* a string
|
||||
*/
|
||||
if (dateString === undefined || dateString === null) {
|
||||
dateString = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that YYYY-MM-DD, YYYY-MM,
|
||||
* YYYY-DD, etc does not get affected
|
||||
|
Reference in New Issue
Block a user