Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'data.toISOString is not a function' #93

Open
gkatsanos opened this issue Jan 4, 2025 · 1 comment
Open

'data.toISOString is not a function' #93

gkatsanos opened this issue Jan 4, 2025 · 1 comment

Comments

@gkatsanos
Copy link

gkatsanos commented Jan 4, 2025

'TypeError: data.toISOString is not a function

stuck in this for hours.. any help would be appreciated!

      const date = new Date().toISOString();
      const response = await eventsApi.createEvent({
        data: {
          type: "event",
          attributes: {
            properties: {
              hotelId,
              checkInDate,
              checkOutDate,
              bookingId,
              firstName,
            },
            time: date,
            uniqueId:"696b3941-6ec8-42cc-854f-1f90be51d8de",
            metric : {
              "data": {
                "type": "metric",
                "attributes": {
                  "name": "Placed Order"
                }
              }
            },
            profile: {
              data: {
                type: 'profile',
                attributes: {
                  email: recipientEmail,
                }
              }
            }
          }
        }
      });
@cpcurtis1218
Copy link

Hi there, is is possible that the error is being thrown from another reference to toISOString() than you've shared here? When I test that line is working for me:
Screenshot 2025-01-07 at 12 44 38 PM
I also want to note that it's not necessary to include the "time" in the event data body - the API will automatically set the time to the moment the event was received by the API and so setting the "time" like this is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants