File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
core/src/components/datetime Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -1532,7 +1532,7 @@ export class Datetime implements ComponentInterface {
1532
1532
class = "day-column"
1533
1533
color = { this . color }
1534
1534
items = { days }
1535
- value = { workingParts . day || this . todayParts . day }
1535
+ value = { '' + ( workingParts . day || this . todayParts . day ) }
1536
1536
onIonChange = { ( ev : CustomEvent ) => {
1537
1537
// Due to a Safari 14 issue we need to destroy
1538
1538
// the intersection observer before we update state
Original file line number Diff line number Diff line change @@ -55,11 +55,13 @@ export const getPartsFromCalendarDay = (el: HTMLElement): DatetimeParts => {
55
55
* We do not use the JS Date object here because
56
56
* it adjusts the date for the current timezone.
57
57
*/
58
- export const parseDate = ( val : string | string [ ] | undefined | null ) : any | undefined => {
59
- // TODO
58
+ export function parseDate ( val : string ) : DatetimeParts ;
59
+ export function parseDate ( val : string [ ] ) : DatetimeParts [ ] ;
60
+ export function parseDate ( val : undefined | null ) : undefined ;
61
+ export function parseDate ( val : string | string [ ] | undefined | null ) : DatetimeParts | DatetimeParts [ ] | undefined ;
62
+ export function parseDate ( val : string | string [ ] | undefined | null ) : DatetimeParts | DatetimeParts [ ] | undefined {
60
63
if ( Array . isArray ( val ) ) {
61
- console . log ( "parseDate not implemented yet for arrays" ) ;
62
- return ;
64
+ return val . map ( valStr => parseDate ( valStr ) ) ;
63
65
}
64
66
65
67
// manually parse IS0 cuz Date.parse cannot be trusted
@@ -103,14 +105,13 @@ export const parseDate = (val: string | string[] | undefined | null): any | unde
103
105
}
104
106
}
105
107
108
+ // can also get second and millisecond from parse[6] and parse[7] if needed
106
109
return {
107
110
year : parse [ 1 ] ,
108
111
month : parse [ 2 ] ,
109
112
day : parse [ 3 ] ,
110
113
hour : parse [ 4 ] ,
111
114
minute : parse [ 5 ] ,
112
- second : parse [ 6 ] ,
113
- millisecond : parse [ 7 ] ,
114
115
tzOffset,
115
116
} ;
116
117
} ;
You can’t perform that action at this time.
0 commit comments