cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Please note that Remote Expert Mobile announced end-of-life and support will end on February 28, 2022.
689
Views
2
Helpful
2
Replies
Highlighted
Beginner

TMS Api Recurrence - Wrong days of week?

Hi All,

I'm having an issue with the API.

I booked a weekly recurring conference that occurs are monday, wednesday and friday that goes from 10:00 PM to 10:30 PM.  (# of recurrences = 5 and Recur every 3 week).

When I call the GetConferenceByID the Conference.ReccurencePattern.DayOfWeek returns Tuesday, Thursday, Saturday.

I'm using the same user in both instances so there should be no time zone conversions.  I see in the database the reccurenceDayofWeekList is 1,3,5 . . . so not sure what's changing this over.

Any suggestions?

Thanks in advanced.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

Re: TMS Api Recurrence - Wrong days of week?

For anyone else coming across this:

After thinking about this a little more and going back and reading the API docs the issue was indeed the timezone.

The API saves the daysofweek in UTC format, so those also need to be converted to the local timezone (I was assuming that the conversion would be done for you, but no timezone transformations are applied based on the usertimezone.).

The easiest way to do this is to take the delta between the 2 and then apply it.

EG:

   For reading:

 

//utc to local  - start is the converted local time.

int WeekDayDelta = (int)start.DayOfWeek - (int)DateTime.Parse(c.StartTimeUTC.Trim('Z'

)).DayOfWeek;

//The Local Day Of week . . . d being a dayofweek c.DaysOfWeek -- +7 in case of negative numbers.

// eg: Sunday(0) start day - 1 =  Saturday (6)

(TMSBooking.DayOfWeek)((((int)d + WeekDayDelta) +7) % 7))

   For Writing back to the DB:

//local to utc. c is the conference, dt is the start time of the conference locally.

int WeekDayDelta = (int)DateTime.Parse(c.StartTimeUTC.Trim('Z')).DayOfWeek - (int

)dt.DayOfWeek;

//The UTC Day Of week  d being a DayOfWeek in c.DaysOfWeek -- +7 in case of negatives. 

// eg: Sunday(0) start day - 1 =  Saturday (6)

(Booking.DayOfWeek)((((int)d+ WeekDayDelta) + 7) %7)

View solution in original post

2 REPLIES 2
Highlighted
Beginner

Re: TMS Api Recurrence - Wrong days of week?

For anyone else coming across this:

After thinking about this a little more and going back and reading the API docs the issue was indeed the timezone.

The API saves the daysofweek in UTC format, so those also need to be converted to the local timezone (I was assuming that the conversion would be done for you, but no timezone transformations are applied based on the usertimezone.).

The easiest way to do this is to take the delta between the 2 and then apply it.

EG:

   For reading:

 

//utc to local  - start is the converted local time.

int WeekDayDelta = (int)start.DayOfWeek - (int)DateTime.Parse(c.StartTimeUTC.Trim('Z'

)).DayOfWeek;

//The Local Day Of week . . . d being a dayofweek c.DaysOfWeek -- +7 in case of negative numbers.

// eg: Sunday(0) start day - 1 =  Saturday (6)

(TMSBooking.DayOfWeek)((((int)d + WeekDayDelta) +7) % 7))

   For Writing back to the DB:

//local to utc. c is the conference, dt is the start time of the conference locally.

int WeekDayDelta = (int)DateTime.Parse(c.StartTimeUTC.Trim('Z')).DayOfWeek - (int

)dt.DayOfWeek;

//The UTC Day Of week  d being a DayOfWeek in c.DaysOfWeek -- +7 in case of negatives. 

// eg: Sunday(0) start day - 1 =  Saturday (6)

(Booking.DayOfWeek)((((int)d+ WeekDayDelta) + 7) %7)

View solution in original post

Highlighted
Beginner

Re: TMS Api Recurrence - Wrong days of week?

is this for all recurrence types?  Monthly and Weekly?

CreatePlease to create content
This widget could not be displayed.