I have a repeater that is populated with data from a .json feed. There is a start_date field that contains quote text with the date and time of an event. Currently the time is displayed in a 24-hour format, and I was wondering if it was possible to display it in an am/pm format, or if I couldn't change it because it was quote text? I was also wondering if it was possible to change the date's format from YYYY-MM-DD to MM-DD-YYYY. I'm very new to coding, so I have no idea if what I'm wanting is even doable. :)
My current code for my repeater:
import { getEvents } from 'backend/events.jsw'
$w.onReady (function () {
$w('#eventsRepeater').onItemReady(($item,itemData,index) => {
$item('#eventImage').src = itemData.image
$item('#eventTitle').text = itemData.title
$item('#eventInfo').text = itemData.description
$item('#eventDate').text = itemData.start_date
});
const populateRepeater = async ()=>{
const events = await getEvents();
const eventData = events.map((char)=> char = {...char, _id: char.id.toString()});
$w('#eventsRepeater').data = eventData
}
populateRepeater();
});
Thanks!
Hi maddie, Assuming that all of your date data follows the same format, you could create a function that would parse the string, extract the relevant data, and reformat it based on your needs. Example GPT prompt:
Best Eitan