Skip to content

Process GET REST data #12689

Answered by melohagan
joeytzy asked this question in Help
Jan 3, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hey @joeytzy

As this is just JavaScript, you could probably find some examples online. Your transformer may look something like this:

function getMonthName(monthNumber) {
  const date = new Date();
  date.setMonth(monthNumber - 1);

  return date.toLocaleString('en-US', {
    month: 'long',
  });
}

return data.yearly.sales.map(sale => ({ ...sale, label: getMonthName(sale.month) + " " + sale.year }))

reference: https://bobbyhadz.com/blog/javascript-convert-month-number-to-name

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joeytzy
Comment options

Answer selected by joeytzy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
javascript Relating to user JavaScript in the builder bb-rest
2 participants