Text management

In the past i've asked how to manage date fileds and to change format from one to an other and @Baptiste has created a script for variable bubble with that has been possible: const inputDate = {{Date}}
const year = inputDate.substr(0, 4); const month = inputDate.substr(4, 2); const day = inputDate.substr(6, 2); const hour = inputDate.substr(9, 2); const minute = inputDate.substr(11, 2); // Create a new Date object const date = new Date(${year}-${month}-${day}T${hour}:${minute}:00); // Format the date const formattedDate = date.toLocaleDateString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric', }); // Format the time const formattedTime = date.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit', hour12: false, }); // Combine formatted date and time return ${formattedDate} ${formattedTime}; Make sure to change {{Date}} with your variable name Now i've an other problem evebr on data management (in this case for text) In a text bubble i've a variable value (TEXT) for example : "my name is Mario" being that i need that this value does not have space and must be "my-name-is-Mario" i'm trying to create a script that tranform my variable TEXT in TEXTTRANSFORMED but after some days and tests i'm not able to do and i'me really sorry to not understand how to do it . I've used all kind of IA but human people are better and so i'me here to ask help so to try to understand how to reach ths result. Have a nice day
2 Replies
Baptiste
Baptiste9mo ago
Try {{TEXT}}.replaceAll(" ", "-")
Mario Barretta
Mario BarrettaOP9mo ago
is perfect. Can you suggest me wher to learn and study something about coding variables? This is Javascript and all suggest that i've found and read on line (and with AI) were more complex and no one has worked.

Did you find this page helpful?