-
Notifications
You must be signed in to change notification settings - Fork 870
Closed
Labels
bugThis issue is a bug.This issue is a bug.dynamodbp1This is a high priority issueThis is a high priority issuequeued
Description
The DynamoDB SDK is converting the datetime
property in local timezone while fetching documents from database, which has stored the datetime in UTC correctly.
Expected Behavior
DateTime should not be converted to local time zone
Current Behavior
The SDK is converting the date time into local time zone
Correct In Dyanmo DB Table (UTC)
While fetching records through SDK
"2019-11-07T12:40:28.445+05:30",
"2019-11-07T12:35:25.071+05:30",
Code to Reproduce :
async Task Main()
{
var dynamo = new DynamoDbService();
var result = await dynamo.GetDocumentsAsync<Documents>("abc");
result.Dump();
}
public class DynamoDbService
{
private static readonly string awsAccessKey = "access key here";
private static readonly string awsSecretKey = "secret here";
private static BasicAWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
private static AmazonDynamoDBClient client = new AmazonDynamoDBClient(awsCredentials, RegionEndpoint.USEast1);
private static DynamoDBContext context = new DynamoDBContext(client);
public async Task InsertDocumentAsync<T>(T document)
{
await context.SaveAsync<T>(document);
}
public async Task<List<T>> GetDocumentsAsync<T>(string id, int limit = 10)
{
QueryFilter filter = new QueryFilter();
filter.AddCondition("doc_id", QueryOperator.Equal, id);
QueryOperationConfig queryConfig = new QueryOperationConfig
{
Filter = filter,
Limit = limit,
BackwardSearch = true
};
var documents = await context.FromQueryAsync<T>(queryConfig, _operationConfig).GetNextSetAsync();
return documents;
}
}
[DynamoDBTable("Table1")]
public class Documents
{
public string doc_id { get; set; }
public string name { get; set; }
public DateTime created { get; set; }
}
ben-foster-cko, Pyrax, JMontagu, dave-allen-cko, stavros-mavrakis-cko and 4 more
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.dynamodbp1This is a high priority issueThis is a high priority issuequeued