-Added support for DateFormatString when reading JSON

This commit is contained in:
James Newton-King
2014-04-26 13:03:04 +12:00
parent 6cc34d026c
commit 35fc7ed0f4
8 changed files with 155 additions and 22 deletions
+9
View File
@@ -713,6 +713,13 @@ namespace Newtonsoft.Json
reader.MaxDepth = _maxDepth;
}
string previousDateFormatString = null;
if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString)
{
previousDateFormatString = reader.DateFormatString;
reader.DateFormatString = _dateFormatString;
}
TraceJsonReader traceJsonReader = (TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose)
? new TraceJsonReader(reader)
: null;
@@ -734,6 +741,8 @@ namespace Newtonsoft.Json
reader.FloatParseHandling = previousFloatParseHandling.Value;
if (_maxDepthSet)
reader.MaxDepth = previousMaxDepth;
if (_dateFormatStringSet)
reader.DateFormatString = previousDateFormatString;
return value;
}