This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/routes/ResourceBookingForm Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import withAuthentication from "../../hoc/withAuthentication";
21
21
import TCForm from "../../components/TCForm" ;
22
22
import { getEditResourceBookingConfig } from "./utils" ;
23
23
import "./styles.module.scss" ;
24
+ import moment from "moment" ;
24
25
25
26
const ResourceBookingDetails = ( { teamId, resourceBookingId } ) => {
26
27
const [ submitting , setSubmitting ] = useState ( false ) ;
@@ -66,8 +67,8 @@ const ResourceBookingDetails = ({ teamId, resourceBookingId }) => {
66
67
67
68
// as we are using `PUT` method (not `PATCH`) we have send ALL the fields
68
69
// fields which we don't send would become `null` otherwise
69
- const getRequestData = ( values ) =>
70
- _ . pick ( values , [
70
+ const getRequestData = ( values ) => {
71
+ const data = _ . pick ( values , [
71
72
"projectId" ,
72
73
"userId" ,
73
74
"jobId" ,
@@ -79,6 +80,17 @@ const ResourceBookingDetails = ({ teamId, resourceBookingId }) => {
79
80
"rateType" ,
80
81
] ) ;
81
82
83
+ // convert dates to the API format before sending
84
+ if ( data . startDate ) {
85
+ data . startDate = moment ( data . startDate ) . format ( 'YYYY-MM-DD' )
86
+ }
87
+ if ( data . endDate ) {
88
+ data . endDate = moment ( data . endDate ) . format ( 'YYYY-MM-DD' )
89
+ }
90
+
91
+ return data
92
+ }
93
+
82
94
return (
83
95
< Page title = "Edit Resource Booking" >
84
96
{ ! formData ? (
You can’t perform that action at this time.
0 commit comments