code: function formatDate(date) {
    let timestamp;
    if (date instanceof Date) {
      // Datadog expects seconds.
      timestamp = Math.round(date.getTime() / 1000);
    } else if (date instanceof Number) {
      // Make sure it is an integer, not a float.
      timestamp = Math.round(date);
    }
    return timestamp;
  }
docs: Formats a date for use with DataDog