File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
packages/react-sdk-components/src/components/field/Date Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import FieldValueList from '../../designSystemExtension/FieldValueList';
66import { format } from '../../helpers/formatters' ;
77import { dateFormatInfoDefault , getDateFormatInfo } from '../../helpers/date-format-utils' ;
88
9+ // Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
10+ function getFormattedDate ( date ) {
11+ return `${ date . $y . toString ( ) } -${ ( date . $M + 1 ) . toString ( ) . padStart ( 2 , '0' ) } -${ date . $D . toString ( ) . padStart ( 2 , '0' ) } ` ;
12+ }
13+
914export default function Date ( props ) {
1015 const {
1116 getPConnect,
@@ -60,13 +65,15 @@ export default function Date(props) {
6065 } ;
6166
6267 const handleChange = date => {
63- const changeValue = date && date . isValid ( ) ? date . toISOString ( ) : null ;
64- onChange ( { value : changeValue } ) ;
68+ if ( date && date . isValid ( ) ) {
69+ onChange ( { value : getFormattedDate ( date ) } ) ;
70+ }
6571 } ;
6672
6773 const handleAccept = date => {
68- const changeValue = date && date . isValid ( ) ? date . toISOString ( ) : null ;
69- handleEvent ( actions , 'changeNblur' , propName , changeValue ) ;
74+ if ( date && date . isValid ( ) ) {
75+ handleEvent ( actions , 'changeNblur' , propName , getFormattedDate ( date ) ) ;
76+ }
7077 } ;
7178
7279 return (
You can’t perform that action at this time.
0 commit comments