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

Time show incorrectly once deployed. Mayb timezone wrong? #12

Open
Mike-Van opened this issue Sep 23, 2019 · 0 comments
Open

Time show incorrectly once deployed. Mayb timezone wrong? #12

Mike-Van opened this issue Sep 23, 2019 · 0 comments

Comments

@Mike-Van
Copy link

Hello, im using this package to build a simple email notification with calendar event. The problem is in local serverless development, the time sent with calendar event is correct. but once i deployed serverless app. somehow the calendar parsed is incorrect. generally 8 hours ahead of my specified time. Here's the code where i build the calendar event.

const createCalendarEvent = data => {
  const { organizer = {}, date, type = 'note', note = '', time, attendees } = data;

  let builder = icalToolkit.createIcsFileBuilder()

  builder.spacers = true; 
  builder.NEWLINE_CHAR = '\r\n'; 
  builder.throwError = false; 
  builder.ignoreTZIDMismatch = true; 
   
  builder.calname = 'CRM Web Activities';
  builder.timezone = 'Asia/Bangkok';
  builder.tzid = 'Asia/Bangkok';
  builder.method = 'REQUEST';

  builder.events.push({
    start: new Date(`${date} ${time}`),
    end: new Date(`${date} ${time}`),
    summary: `New ${type}.`,
    description: note,
    organizer: {
      name: organizer.name,
      email: organizer.email
    },
    attendees: attendees.map(user => { return { name: user.name, email: user.email } })
  });

  const response = {
    alternatives: [{
      contentType: 'text/calendar; charset="utf-8"; method=REQUEST',
      content: builder.toString()
    }]
  };

  return response;
}
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

1 participant