Repository: plone/plone.restapi (language: python)

Issue:
Documentation of event content type does not return a timezone
The Event content type response returns `start` and `end` datetimes with a timezone:

```
  "end": "2023-12-31T12:00:00+00:00", 
  "start": "2023-01-01T11:00:00+00:00", 
```

However, in the documentation of the Event content type response, the `start` and `end` datetimes do not display a timezone indicator.

https://6.docs.plone.org/plone.restapi/docs/source/endpoints/content-types.html#event

```
    "end": "2013-01-01T12:00:00",
    "start": "2013-01-01T10:00:00",
```

@davisagli explained that this is due to a mock in the tests to avoid grabbing the current datetime that would result in a failure.

The documentation should reflect the actual response, not the mock.


Discussion / hints:

Fix patch:
diff --git a/news/1776.documentation b/news/1776.documentation
new file mode 100644
index 0000000000..a1e34cf4af
--- /dev/null
+++ b/news/1776.documentation
@@ -0,0 +1,1 @@
+Fix event start & end timezone in documentation examples. @davisagli


Test patch:
diff --git a/src/plone/restapi/tests/http-examples/event.resp b/src/plone/restapi/tests/http-examples/event.resp
index a8538c9fc6..2591e61803 100644
--- a/src/plone/restapi/tests/http-examples/event.resp
+++ b/src/plone/restapi/tests/http-examples/event.resp
@@ -44,7 +44,7 @@ Content-Type: application/json
     ],
     "description": "This is an event",
     "effective": null,
-    "end": "2013-01-01T12:00:00",
+    "end": "2013-01-01T12:00:00+00:00",
     "event_url": null,
     "exclude_from_nav": false,
     "expires": null,
@@ -78,7 +78,7 @@ Content-Type: application/json
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
-    "start": "2013-01-01T10:00:00",
+    "start": "2013-01-01T10:00:00+00:00",
     "subjects": [],
     "sync_uid": null,
     "text": null,
diff --git a/src/plone/restapi/tests/test_documentation.py b/src/plone/restapi/tests/test_documentation.py
index e10c2e97cf..9c0fc9d342 100644
--- a/src/plone/restapi/tests/test_documentation.py
+++ b/src/plone/restapi/tests/test_documentation.py
@@ -1,5 +1,6 @@
 from base64 import b64encode
 from datetime import datetime
+from datetime import timezone
 from pkg_resources import resource_filename
 from plone import api
 from plone.app.discussion.interfaces import ICommentAddedEvent
@@ -319,8 +320,8 @@ def test_documentation_event(self):
         self.portal.invokeFactory("Event", id="event")
         self.portal.event.title = "Event"
         self.portal.event.description = "This is an event"
-        self.portal.event.start = datetime(2013, 1, 1, 10, 0)
-        self.portal.event.end = datetime(2013, 1, 1, 12, 0)
+        self.portal.event.start = datetime(2013, 1, 1, 10, 0, tzinfo=timezone.utc)
+        self.portal.event.end = datetime(2013, 1, 1, 12, 0, tzinfo=timezone.utc)
         transaction.commit()
         response = self.api_session.get(self.portal.event.absolute_url())
         save_request_and_response_for_docs("event", response)