Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2f87ef3

Browse files
committed
feat: don't use time for Resource Bookings
1 parent 5b819fe commit 2f87ef3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/routes/ResourceBookingForm/index.jsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import withAuthentication from "../../hoc/withAuthentication";
2121
import TCForm from "../../components/TCForm";
2222
import { getEditResourceBookingConfig } from "./utils";
2323
import "./styles.module.scss";
24+
import moment from "moment";
2425

2526
const ResourceBookingDetails = ({ teamId, resourceBookingId }) => {
2627
const [submitting, setSubmitting] = useState(false);
@@ -66,8 +67,8 @@ const ResourceBookingDetails = ({ teamId, resourceBookingId }) => {
6667

6768
// as we are using `PUT` method (not `PATCH`) we have send ALL the fields
6869
// 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, [
7172
"projectId",
7273
"userId",
7374
"jobId",
@@ -79,6 +80,17 @@ const ResourceBookingDetails = ({ teamId, resourceBookingId }) => {
7980
"rateType",
8081
]);
8182

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+
8294
return (
8395
<Page title="Edit Resource Booking">
8496
{!formData ? (

0 commit comments

Comments
 (0)