jagan-parthiban commented on code in PR #7408:
URL: https://github.com/apache/trafficcontrol/pull/7408#discussion_r1170305489


##########
docs/source/api/v5/service_categories.rst:
##########
@@ -78,13 +78,13 @@ Response Structure
        Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 
GMT; Max-Age=3600; HttpOnly
        Whole-Content-Sha512: 
Yzr6TfhxgpZ3pbbrr4TRG4wC3PlnHDDzgs2igtz/1ppLSy2MzugqaGW4y5yzwzl5T3+7q6HWej7GQZt1XIVeZQ==
        X-Server-Name: traffic_ops_golang/
-       Date: Wed, 11 Mar 2020 20:02:47 GMT
+       Date: Wed, 29 Mar 2023 15:56:34 GMT
        Content-Length: 102
 
        {
                "response": [
                        {
-                               "lastUpdated": "2020-03-04 15:46:20-07",
+                               "lastUpdated": 
"2023-03-29T19:43:17.557642+05:30",

Review Comment:
   ![Screenshot 2023-04-18 at 9 58 32 
PM](https://user-images.githubusercontent.com/33490370/232843314-6608cd07-bf66-4894-94e1-6cc033522a6c.png)
   
   Traffic Ops always gives local time for me.  
   
   - Current time format used in the code from tafficcontrol/lib/go-tc/time.go
   
   `const TimeLayout = "2006-01-02 15:04:05-07" 
   `
   
   - Because the timezone offset is cut to only hour hand “07" and minute hand 
is left out ":00", it creates issues to countries which have UTC offset in 
minutes. For eg, India its +05:30. And it is rounded of to +05, as there is no 
minute format definition.
   
   - So any API response which returns time, is returning incorrect time from 
India. This applies to any countries that have offset with minutes.
   
   - Since none of the US time zones have UTC offset in minutes, this issue 
will not be observed from US.
   
   Example,
   API Call:
   `$ curl -k -X POST -H "Content-Type: application/json" --cookie 
$mojolicious_id --data @test_data.json 
"https://localhost:8443/api/4.1/service_categories";  `  
   
   API Response:
   
   ```
   {
     "alerts": [
       {
         "text": "serviceCategory was created.",
         "level": "success"
       }
     ],
     "response": {
       "lastUpdated": "2023-03-13 13:52:02+05",
       "name": "apps"
     }
   }
   
   ```
   
   - This time layout inadvertently contributes to the failure of the testcases 
if run out of US as well.
   
   - Example: The following test case from "TestStatsSummary" fails with 
error,- 
   
   ```
   === RUN   TestStatsSummary/GET/OK_when_VALID_LASTSUMMARYDATE_parameter
       stats_summary_test.go:146: Not equal. Expected: 2023-03-13 13:56:35 
+0530 IST Actual: 2023-03-13 14:26:35 +0500 +0500 Messages: Expected 
SummaryTime to be 2023-03-13 13:56:35 +0530 IST, but got 2023-03-13 14:26:35 
+0500 +0500
   
   --- FAIL: TestStatsSummary (0.01s)
       --- FAIL: TestStatsSummary/GET (0.00s)
           --- FAIL: 
TestStatsSummary/GET/OK_when_VALID_LASTSUMMARYDATE_parameter (0.00s)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to