# Date field needs to be converted

**URL:** <https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277>\
**Category:** Ask the community\
**Tags:** question, code, wix-members-area, wix\
**Created:** [February 2, 2025, 7:12pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277 "2025-02-02T19:12:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristofer\_Bath](https://avatars.discourse-cdn.com/v4/letter/k/8797f3/32.png) [@Kristofer\_Bath](https://forum.wixstudio.com/u/Kristofer_Bath)\
**Post date:** [February 2, 2025, 7:13pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277/1 "2025-02-02T19:13:00Z")

</div>

**Question:**  
I use this code to update a collection field with dates but whatever I do it always show a yellow row with an exclamation mark telling me that it needs to be converted to date so please help me with this extremely difficult task. No dataset connected because this is about mapped dates so I can´t choose a specific date field. The code makes the date get into the correct members field cell:

let today = new Date($w(“#engdate”).value); const formattedDate = today.toLocaleDateString(“en-US”, { day: “numeric”, month: “short”, year: “numeric”, }); member[rentalStartField] = today; console.log(“Updated rental start date:”, formattedDate); await wixData.update(“Members”, { …member, …updateData });

Here I show it in another way:

$w(“#engBuy”).onClick(async () =\> {  
let today = new Date($w(“#engdate”).value);  
const adjustedDate = today.toLocaleDateString(“en-US”, {  
})  
member[rentalStartField] = adjustedDate;  
console.log(“Updated rental start date:”, adjustedDate);

```
    await wixData.update("Members", { ...member, ...updateData });

```

**Product:**  
[Wix Editor]

**What are you trying to achieve:**  
[To update the date fields with a correct format value.]

---

<div class="post-metadata">

**Author:** ![emmy](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/emmy/32/113141_2.png) [@emmy](https://forum.wixstudio.com/u/emmy)\
**Post date:** [February 3, 2025, 8:12pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277/2 "2025-02-03T20:12:47Z")

</div>

It sounds like you are using the Date field without the “include Time field” selected. This means you need to convert this to an ISO string, and then cut the time part out of the string. So something like `today.toISOString().substring(0, 10)`

Here’s a [thread](https://forum.wixstudio.com/t/capturing-todays-date-for-cms-field/58468/2) asking a very similar question that might help.

---

<div class="post-metadata">

**Author:** ![Kristofer\_Bath](https://avatars.discourse-cdn.com/v4/letter/k/8797f3/32.png) [@Kristofer\_Bath](https://forum.wixstudio.com/u/Kristofer_Bath)\
**Post date:** [February 3, 2025, 9:30pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277/3 "2025-02-03T21:30:45Z")

</div>

Thank you very much Emmy but I find it very frustrating that such important information is almost actively hidden by Wix support. I have tried in many different ways and for many days until you finaly told me this solution.

---

<div class="post-metadata">

**Author:** ![emmy](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/emmy/32/113141_2.png) [@emmy](https://forum.wixstudio.com/u/emmy)\
**Post date:** [February 3, 2025, 9:44pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277/4 "2025-02-03T21:44:29Z")

</div>

No problem! Your frustration is totally understandable, I’ll pass this feedback along.

---

<div class="post-metadata">

**Author:** ![Kristofer\_Bath](https://avatars.discourse-cdn.com/v4/letter/k/8797f3/32.png) [@Kristofer\_Bath](https://forum.wixstudio.com/u/Kristofer_Bath)\
**Post date:** [February 3, 2025, 10:16pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277/5 "2025-02-03T22:16:52Z")

</div>

By the way, how can I combine today.toISOString().substring(0, 10) with a specific format?

---

<div class="post-metadata">

**Author:** ![emmy](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/emmy/32/113141_2.png) [@emmy](https://forum.wixstudio.com/u/emmy)\
**Post date:** [February 4, 2025, 5:17pm UTC](https://forum.wixstudio.com/t/date-field-needs-to-be-converted/68277/6 "2025-02-04T17:17:30Z")

</div>

Hmm I’m not sure what you mean, could you clarify the format you’re trying to combine with?
