WorkoutDay and StartTime overrides - TrainingPeaks/PartnersAPI GitHub Wiki
For file upload, partners have several options for WorkoutDay and StartTime.
- Use WorkoutDay and StartTime within the upload file.
- Use WorkoutDay and StartTime override with local date/time.
- Use WorkoutDay and StartTime override with timezone specified.
DateTime Basics and Format
Date/time should be specified in ISO8601 format. (wikipedia - ISO8601)
- Example for WorkoutDay
- 2020-01-31
- 2020-01-31T00:00:00
- 2020-01-31T00:00:00-06:00
- Example for StartTime
- 2020-01-31T13:59:59
- 2020-01-31T13:59:59-06:00
When local date/time is passed as override
(Local date/time is when time zone is not specified)
The information passed in WorkoutDay and StartTime will be what is displayed in TrainingPeaks UI.
Example:
Athlete's time zone setting: Amercica/Denver (GMT-06)
In file upload body:
{
"UploadClient": "app_name",
"Filename": "file_name.tcx",
"Data": "encoded_content",
"WorkoutDay": "2020-01-31",
"StartTime": "2020-01-31T13:14:15"
}
The result that athlete would see in TrainingPeaks UI will be
Date: 2020-01-31
Start Time: 13:14:15 (01:14:15 PM)
When date/time is passed with time zone
WorkoutDay and StartTime will be both calculated based on time zone passed from Partner and the Athlete's time zone setting within TrainingPeaks. When Partner application is using time zone to override the WorkoutDay and StartTime,
- Time zone information is compared with athlete's time zone.
- Based on step #1, our API will convert time to athlete's local time to store.
- When reading workout data, the athlete's local date/time will be displayed.
Example with time zone #1:
Athlete's time zone setting: Amercica/Denver (GMT-06)
In file upload body:
{
"UploadClient": "app_name",
"Filename": "file_name.tcx",
"Data": "encoded_content",
"WorkoutDay": "2020-01-31",
"StartTime": "2020-01-31T13:14:15+08:00"
}
The result that athlete would see in TrainingPeaks UI will be
Date: 2020-01-31
Start Time: 23:14:15 (11:14:15 PM)
Example with time zone #2:
Athlete's time zone setting: Amercica/Denver (GMT-06)
In file upload body:
{
"UploadClient": "app_name",
"Filename": "file_name.tcx",
"Data": "encoded_content",
"WorkoutDay": "2020-01-31",
"StartTime": "2020-01-31T13:14:15-06:00"
}
The result that athlete would see in TrainingPeaks UI will be
Date: 2020-01-31
Start Time: 13:14:15 (01:14:15 PM)
(Only for .fit files) Virtual Activity flag.
If the workout is virtual activity, set the sub sport to VirtualActivity. When the sub sport is set to VirtualActivity, we will ignore the GPS information in the fit file from calculating the workout date/time.