Skip to content

Instantly share code, notes, and snippets.

@leifermendez
Created March 22, 2024 09:08
Show Gist options
  • Select an option

  • Save leifermendez/5c8bc3bd3ec52edefd86ddda5cb20262 to your computer and use it in GitHub Desktop.

Select an option

Save leifermendez/5c8bc3bd3ec52edefd86ddda5cb20262 to your computer and use it in GitHub Desktop.
calendar-plus-minutes.js
{{ (() => {
const gap = 45
const startDate = new Date($json["body"]["startDate"]);
const endDate = new Date(startDate.getTime() + (gap * 60 * 1000));
const formatNumber = (num) => (num < 10 ? '0' : '') + num;
const formattedDate = endDate.getFullYear() + '/' +
formatNumber(endDate.getMonth() + 1) + '/' +
formatNumber(endDate.getDate()) + ' ' +
formatNumber(endDate.getHours()) + ':' +
formatNumber(endDate.getMinutes()) + ':' +
formatNumber(endDate.getSeconds());
return formattedDate;
})() }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment