Skip to content

Commit 52a423c

Browse files
printing utc time
1 parent c59e8ab commit 52a423c

File tree

2 files changed

+37
-32
lines changed

2 files changed

+37
-32
lines changed

src/courses.ts

+28-28
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ export function Register(store: Store<State, Actions>) {
188188
store.dispatch(
189189
Action.registerWorkshop({
190190
id: 'LK8S|SINGAPORE|20191127',
191-
startAt: new Date('2019-11-27T10:00:00').toISOString(),
192-
endsAt: new Date('2019-11-29T17:00:00').toISOString(),
191+
startAt: '2019-11-27T10:00:00',
192+
endsAt: '2019-11-29T17:00:00',
193193
timezone: 'Asia/Singapore',
194194
courseId: NewCourses.threeDays.id,
195195
priceId: NewCoursePrice.Singapore.id,
@@ -200,8 +200,8 @@ export function Register(store: Store<State, Actions>) {
200200
store.dispatch(
201201
Action.registerWorkshop({
202202
id: 'LK8S|LONDON|20191202',
203-
startAt: new Date('2019-12-02T09:30:00').toISOString(),
204-
endsAt: new Date('2019-12-04T05:00:00').toISOString(),
203+
startAt: '2019-12-02T09:30:00',
204+
endsAt: '2019-12-04T05:00:00',
205205
timezone: 'Europe/London',
206206
courseId: NewCourses.threeDays.id,
207207
priceId: NewCoursePrice.GreatBritain.id,
@@ -212,8 +212,8 @@ export function Register(store: Store<State, Actions>) {
212212
store.dispatch(
213213
Action.registerWorkshop({
214214
id: 'LK8S|SYDNEY|20191216',
215-
startAt: new Date('2019-12-16T09:30:00').toISOString(),
216-
endsAt: new Date('2019-12-18T05:00:00').toISOString(),
215+
startAt: '2019-12-16T09:30:00',
216+
endsAt: '2019-12-18T05:00:00',
217217
timezone: 'Australia/Sydney',
218218
courseId: NewCourses.threeDays.id,
219219
priceId: NewCoursePrice.Sydney.id,
@@ -224,8 +224,8 @@ export function Register(store: Store<State, Actions>) {
224224
store.dispatch(
225225
Action.registerWorkshop({
226226
id: 'LK8S|TORONTO|20200129',
227-
startAt: new Date('2020-01-29T09:30:00').toISOString(),
228-
endsAt: new Date('2020-01-31T05:00:00').toISOString(),
227+
startAt: '2020-01-29T09:30:00',
228+
endsAt: '2020-01-31T05:00:00',
229229
timezone: 'America/Toronto',
230230
courseId: NewCourses.threeDays.id,
231231
priceId: NewCoursePrice.Canada.id,
@@ -236,8 +236,8 @@ export function Register(store: Store<State, Actions>) {
236236
store.dispatch(
237237
Action.registerWorkshop({
238238
id: 'LK8S|SANFRANCISCO|20200203',
239-
startAt: new Date('2020-02-03T09:30:00').toISOString(),
240-
endsAt: new Date('2020-02-05T05:00:00').toISOString(),
239+
startAt: '2020-02-03T09:30:00',
240+
endsAt: '2020-02-05T05:00:00',
241241
timezone: 'America/Los_Angeles',
242242
courseId: NewCourses.threeDays.id,
243243
priceId: NewCoursePrice.UnitedStates.id,
@@ -248,8 +248,8 @@ export function Register(store: Store<State, Actions>) {
248248
store.dispatch(
249249
Action.registerWorkshop({
250250
id: 'LK8S|ZURICH|20200210',
251-
startAt: new Date('2020-02-10T09:30:00').toISOString(),
252-
endsAt: new Date('2020-02-12T05:00:00').toISOString(),
251+
startAt: '2020-02-10T09:30:00',
252+
endsAt: '2020-02-12T05:00:00',
253253
timezone: 'Europe/Zurich',
254254
courseId: NewCourses.threeDays.id,
255255
priceId: NewCoursePrice.Switzerland.id,
@@ -260,8 +260,8 @@ export function Register(store: Store<State, Actions>) {
260260
store.dispatch(
261261
Action.registerWorkshop({
262262
id: 'LK8S|VIENNA|20200217',
263-
startAt: new Date('2020-02-17T09:30:00').toISOString(),
264-
endsAt: new Date('2020-02-19T05:00:00').toISOString(),
263+
startAt: '2020-02-17T09:30:00',
264+
endsAt: '2020-02-19T05:00:00',
265265
timezone: 'Europe/Vienna',
266266
courseId: NewCourses.threeDays.id,
267267
priceId: NewCoursePrice.Austria.id,
@@ -272,8 +272,8 @@ export function Register(store: Store<State, Actions>) {
272272
store.dispatch(
273273
Action.registerWorkshop({
274274
id: 'LK8S|SINGAPORE|20200217',
275-
startAt: new Date('2020-02-17T10:00:00').toISOString(),
276-
endsAt: new Date('2020-02-19T17:00:00').toISOString(),
275+
startAt: '2020-02-17T10:00:00',
276+
endsAt: '2020-02-19T17:00:00',
277277
timezone: 'Asia/Singapore',
278278
courseId: NewCourses.threeDays.id,
279279
priceId: NewCoursePrice.Singapore.id,
@@ -284,8 +284,8 @@ export function Register(store: Store<State, Actions>) {
284284
store.dispatch(
285285
Action.registerWorkshop({
286286
id: 'LK8S|PARIS|20200217',
287-
startAt: new Date('2020-02-17T10:00:00').toISOString(),
288-
endsAt: new Date('2020-02-19T17:00:00').toISOString(),
287+
startAt: '2020-02-17T10:00:00',
288+
endsAt: '2020-02-19T17:00:00',
289289
timezone: 'Europe/Paris',
290290
courseId: NewCourses.threeDays.id,
291291
priceId: NewCoursePrice.France.id,
@@ -296,8 +296,8 @@ export function Register(store: Store<State, Actions>) {
296296
store.dispatch(
297297
Action.registerWorkshop({
298298
id: 'LK8S|SYDNEY|20200304',
299-
startAt: new Date('2020-03-04T09:30:00').toISOString(),
300-
endsAt: new Date('2020-03-06T05:00:00').toISOString(),
299+
startAt: '2020-03-04T09:30:00',
300+
endsAt: '2020-03-06T05:00:00',
301301
timezone: 'Australia/Sydney',
302302
courseId: NewCourses.threeDays.id,
303303
priceId: NewCoursePrice.Sydney.id,
@@ -308,8 +308,8 @@ export function Register(store: Store<State, Actions>) {
308308
store.dispatch(
309309
Action.registerWorkshop({
310310
id: 'LK8S|BERLIN|20200304',
311-
startAt: new Date('2020-02-26T09:30:00').toISOString(),
312-
endsAt: new Date('2020-02-28T05:00:00').toISOString(),
311+
startAt: '2020-02-26T09:30:00',
312+
endsAt: '2020-02-28T05:00:00',
313313
timezone: 'Europe/Berlin',
314314
courseId: NewCourses.threeDays.id,
315315
priceId: NewCoursePrice.Germany.id,
@@ -320,8 +320,8 @@ export function Register(store: Store<State, Actions>) {
320320
store.dispatch(
321321
Action.registerWorkshop({
322322
id: 'LK8S|LONDON|20200311',
323-
startAt: new Date('2020-03-11T09:30:00').toISOString(),
324-
endsAt: new Date('2020-03-13T05:00:00').toISOString(),
323+
startAt: '2020-03-11T09:30:00',
324+
endsAt: '2020-03-13T05:00:00',
325325
timezone: 'Europe/London',
326326
courseId: NewCourses.threeDays.id,
327327
priceId: NewCoursePrice.GreatBritain.id,
@@ -332,8 +332,8 @@ export function Register(store: Store<State, Actions>) {
332332
store.dispatch(
333333
Action.registerWorkshop({
334334
id: 'LK8S|HONGKONG|20200311',
335-
startAt: new Date('2020-03-11T09:30:00').toISOString(),
336-
endsAt: new Date('2020-03-13T05:00:00').toISOString(),
335+
startAt: '2020-03-11T09:30:00',
336+
endsAt: '2020-03-13T05:00:00',
337337
timezone: 'Asia/Hong_Kong',
338338
courseId: NewCourses.threeDays.id,
339339
priceId: NewCoursePrice.HongKong.id,
@@ -344,8 +344,8 @@ export function Register(store: Store<State, Actions>) {
344344
store.dispatch(
345345
Action.registerWorkshop({
346346
id: 'LK8S|MILAN|20200318',
347-
startAt: new Date('2020-03-18T09:30:00').toISOString(),
348-
endsAt: new Date('2020-03-20T05:00:00').toISOString(),
347+
startAt: '2020-03-18T09:30:00',
348+
endsAt: '2020-03-20T05:00:00',
349349
timezone: 'Europe/Rome',
350350
courseId: NewCourses.threeDaysIT.id,
351351
priceId: NewCoursePrice.Italy.id,

src/eventbrite.v2.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ function isSameDescription(a: { code: string; description: string }, b: { descri
146146
)
147147
}
148148

149-
function isSameDate(a: { startAt: string }, b: EventEventBrite) {
150-
return new Date(a.startAt).valueOf() === new Date(b.start.utc).valueOf()
149+
function isSameDate(a: { startAt: string; timezone: string }, b: EventEventBrite) {
150+
return zonedTimeToUtc(a.startAt, a.timezone).valueOf() === new Date(b.start.utc).valueOf()
151151
}
152152

153153
function isSamePrice(a: { price: number }, b: EventEventBrite) {
@@ -189,11 +189,15 @@ function upsertEvent(
189189
},
190190
start: {
191191
timezone: event.timezone,
192-
utc: new Date(event.startAt).toISOString().replace('.000Z', 'Z'),
192+
utc: zonedTimeToUtc(event.startAt, event.timezone)
193+
.toISOString()
194+
.replace('.000Z', 'Z'),
193195
},
194196
end: {
195197
timezone: event.timezone,
196-
utc: new Date(event.endsAt).toISOString().replace('.000Z', 'Z'),
198+
utc: zonedTimeToUtc(event.endsAt, event.timezone)
199+
.toISOString()
200+
.replace('.000Z', 'Z'),
197201
},
198202
currency: event.currency,
199203
online_event: true,
@@ -206,6 +210,7 @@ function upsertEvent(
206210
format_id: 9, // Class, Training, or Workshop (1 for Conference)
207211
},
208212
}
213+
console.log(body)
209214
const venue = venues.find(it => it.name === event.locationName)
210215
if (!!venue) {
211216
body.event.venue_id = venue.id

0 commit comments

Comments
 (0)