File tree 1 file changed +3
-2
lines changed
src/main/resources/META-INF/frontend/fc-inline-date-picker
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 18
18
* #L%
19
19
*/
20
20
import { css , html , LitElement } from 'lit' ;
21
+ import { formatDate } from '../fc-year-calendar/fc-calendar-utils.js' ;
21
22
22
23
export class InlineDatePicker extends LitElement {
23
24
@@ -41,13 +42,13 @@ export class InlineDatePicker extends LitElement {
41
42
willUpdate ( changedProperties ) {
42
43
if ( changedProperties . has ( 'value' ) ) {
43
44
this . date = this . value ? new Date ( this . value ) : undefined ;
44
- if ( this . date ) {
45
+ if ( this . date && this . date . getTimezoneOffset ( ) > 0 ) {
45
46
// normalize date ignoring browser timezone
46
47
this . date = new Date ( this . date . toISOString ( ) . slice ( 0 , - 1 ) ) ;
47
48
}
48
49
}
49
50
if ( changedProperties . has ( 'date' ) ) {
50
- this . value = this . date ? this . date . toISOString ( ) . substring ( 0 , 10 ) : undefined ;
51
+ this . value = this . date ? formatDate ( this . date ) . substring ( 0 , 10 ) : undefined ;
51
52
this . displayDate = this . date || this . displayDate ;
52
53
}
53
54
if ( changedProperties . has ( 'displayDate' ) ) {
You can’t perform that action at this time.
0 commit comments