kelvinRosa / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

.NET Client returns incorrect Recording Date #481

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The .NET Client VideosResource.ListRequest returns a date that is one day 
before the date that was set in RecordingDetails during the 
videosInsertRequest.UploadAsync(CancellationToken). The Edit / Info and 
Settings, Advanced Settings page in the Video Manager area of YouTube shows the 
correct date.

What steps will reproduce the problem?
strVideoIds = 
"pQMAU1GzgWQ,xVfXl0AFCBw,CuK58vjGEQc,OGds6kZ0Pio,AUtGPSEZTRQ,6B2dN7azd28,6Q8Qs2K
G3w8,r6QJwy9DLhM,w4ZNa1y98io"
Dim objListRequest As VideosResource.ListRequest
Dim objVideoListResponse As VideoListResponse = Nothing
objListRequest = New VideosResource.ListRequest(objYouTubeService, 
"id,snippet,recordingDetails,status")
objListRequest.Id = strVideoIds
objVideoListResponse = Await objListRequest.ExecuteAsync
For Each objVideo As Video In objVideoListResponse.Items
    If objVideo.RecordingDetails.RecordingDate IsNot Nothing Then
            Debug.WriteLine("Video id: " & objVideo.Id & ": " & Format(objVideo.RecordingDetails.RecordingDate, "yyyy-MM-dd"))
        End If
    End If
Next

What is the expected output? What do you see instead?
The videos that are dated May 20 show a Recording Date of May 21 on the 
Advanced Settings page in YT Video Manager. They were uploaded with 
RecordingDate set to May 21.

The videos that are dated July 01 show a Recording Date of July 02 on the 
Advanced Settings page in YT Video Manager. They were uploaded with 
RecordingDate set to July 02.

Debug.WriteLine Output:
Video id: pQMAU1GzgWQ: 2014-05-20
Video id: xVfXl0AFCBw: 2014-05-20
Video id: CuK58vjGEQc: 2014-05-20
Video id: OGds6kZ0Pio: 2014-05-20
Video id: AUtGPSEZTRQ: 2014-05-20
Video id: 6B2dN7azd28: 2014-07-01
Video id: 6Q8Qs2KG3w8: 2014-07-01
Video id: r6QJwy9DLhM: 2014-07-01
Video id: w4ZNa1y98io: 2014-07-01

What version of the product are you using?
  <package id="Google.Apis" version="1.8.2" targetFramework="net40" />
  <package id="Google.Apis.Auth" version="1.8.2" targetFramework="net40" />
  <package id="Google.Apis.Core" version="1.8.2" targetFramework="net40" />
  <package id="Google.Apis.YouTube.v3" version="1.8.1.1100" targetFramework="net40" />
  <package id="log4net" version="2.0.3" targetFramework="net40" />
  <package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" />
  <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
  <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
  <package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="6.0.3" targetFramework="net40" />
  <package id="Zlib.Portable" version="1.10.0" targetFramework="net40" />

What is your operating system? Windows 8.1
What is your IDE? Visual Studio 2013
What is the .NET framework version? 4.0

Please provide any additional information below.
The Videos were uploaded on July 11 with the RecordingDetails.RecordingDate set 
to 2014-05-21 or 2014-07-02. Immediately after the upload, the correct date was 
present in the Advanced Settings tab of Edit / Info and Settings in YT Video 
Manager.
The .NET Client ListRequest was executed five days after the upload. The 
RecordingDate returned by the ListRequest is one day before the date that shows 
in Video Manager.

Original issue reported on code.google.com by eltownh...@gmail.com on 16 Jul 2014 at 3:03

GoogleCodeExporter commented 9 years ago
I have attached a screen capture of Fiddler that shows in the JSON format 
returned from the server, the date is 2014-05-21. The correct date. The Google 
API V3 .NET Client returns the date as 2014-05-20.

Original comment by eltownh...@gmail.com on 16 Jul 2014 at 6:02

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I think this is the issue. 

The date value set to RecordingDate during the upload is used as a 
UniversalTime and not converted to UniversalTime. Therefore, when it is 
retrieved into the .NET application and converted from UniversalTime to 
LocalTime, the date becomes one less than the date originally input.

Here is my workaround to be used when retrieving RecordingDate:
   CDate(objVideo.RecordingDetails.RecordingDate).ToUniversalTime

Original comment by eltownh...@gmail.com on 16 Jul 2014 at 8:57

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 31 Jul 2014 at 2:49