Does anyone know how to get valid module start and end date when there is holidays/break?

If i follow https://docs.valence.desire2learn.com/res/content.html documentation,
when I do api call
GET /d2l/api/le/(version)/(orgUnitId)/content/modules/(moduleId)
i always get modulestartdate and moduleenddate as null.
إجابات
-
Is there any other way of getting these dates accurate?
-
Hi Anuja.
Upon the course copy process - you can identify the days to offset via API using this link: Courses (course offerings, templates, schemas) — Developer Platform (March 2023) (desire2learn.com). All my testing and visualization below is using Postman as an example.
For handling holidays:
Due to regional holidays varying around the world, it's not easy to automatically calculate the days and handle offsets based on different organization schedules. This issue is due to various holidays in different regions/countries such as Martin Luther King Jr. Day (a US-based holiday not shared with other countries).
Institutions need to account for this date offset when building their API offsets and either add days based on their academic holidays or otherwise. There is a PIE (D6657) item that other customers have put forward in the past to request a "vacation" or "time off" component to Brightspace. Putting your business requirements in this PIE item may serve well to ensure your organization's needs are met.
You will need to use a date calculator to do the offset, or if you are using a course master standard - add the extra days as appropriate. You may need to use a programming language to calculate the difference between two dates in an automated script. This is a non-D2L endorsed example using JavaScript: datetime - How to calculate date difference in JavaScript? - Stack Overflow
Content Topic - API to pull dates:
For your specific example - here is an example where I'm able to retrieve the time/date using my test system for the content topics.
Syntax: GET {{BrightspaceDomain}}/d2l/api/le/{{leversion}}/{{orgunitid}}/content/topics/{{topicId}}
Output (JSON Format):
{
"ActivityId": "https://ids.brightspace.com/activities/contenttopic/D2TAM-38475",
"IsExempt": false,
"DueDate": "2022-02-12T14:00:00.000Z",
"Description": {
"Text": "",
"Html": ""
},
"ParentModuleId": 69356,
"OpenAsExternalResource": null,
"TopicType": 1,
"Url": "/content/enforced/7126-BC101/Testing Dates & Times Due for Content.html",
"StartDate": "2022-02-02T14:00:00.000Z",
"EndDate": "2022-02-19T14:00:00.000Z",
"IsHidden": false,
"IsLocked": false,
"ActivityType": 1,
"ToolId": null,
"ToolItemId": null,
"GradeItemId": null,
"Id": 75060,
"Title": "Testing Dates & Times Due for Content",
"ShortTitle": "",
"Type": 1,
"LastModifiedDate": "2022-02-02T14:45:40.153Z"
}
Content Module:
For the content module - you may need to use an API command such as described here: Course content (content objects, ISBNs, tables of content) — Developer Platform (March 2023) (desire2learn.com).
One thing to check is to review the Brightspace Data Set (if your running into problems) you are using the latest content object ID as possible. This did trip me up when trying to reproduce the issue.
When you use the syntax (for my example - this is what I used: {{BrightspaceDomain}}/d2l/api/le/{{lpversion}}/{{orgunitid}}/content/modules/{{moduleId}}
My JSON information came back as follows:
{
"Description": {
"Text": "Testing date/times",
"Html": "<p>Testing date/times</p>"
},
"ParentModuleId": null,
"ModuleDueDate": "2023-02-10T17:00:00.000Z",
"Structure": [
{
"Id": 75060,
"Title": "Testing Dates & Times Due for Content",
"ShortTitle": "",
"Type": 1,
"LastModifiedDate": "2022-02-02T14:45:40.153Z"
},
{
"Id": 75061,
"Title": "Testing Dates & Times Due for Assignments",
"ShortTitle": "",
"Type": 1,
"LastModifiedDate": "2022-02-02T14:45:45.233Z"
},
{
"Id": 75062,
"Title": "Testing Dates & Times Due for Discussions",
"ShortTitle": "",
"Type": 1,
"LastModifiedDate": "2022-02-02T14:47:05.473Z"
},
{
"Id": 75490,
"Title": "Video Test",
"ShortTitle": "",
"Type": 0,
"LastModifiedDate": "2023-02-24T16:18:17.897Z"
}
],
"ModuleStartDate": "2023-02-01T17:00:00.000Z",
"ModuleEndDate": "2023-03-03T17:00:00.000Z",
"IsHidden": false,
"IsLocked": false,
"Id": 69356,
"Title": "Testing date/times",
"ShortTitle": "",
"Type": 0,
"LastModifiedDate": "2023-02-24T17:47:52.263Z"
}
The illustration from my Brightspace test course of the screen is referenced in the above JSON:
Let me know how you get along and if this helps.
Thanks - Bruce.
-
Thank you for the quick reply. This makes sense. I have tried using it.