ServiceStack/ServiceStack.Text — pull request #306 by davybrion (2013-04-09 13:57:29+00:00)
Title: test + fix for incorrect serialization of datetime values without milliseconds by TypeSerializer

Added the following failing test:

[Test]
public void DateTimeWithoutMilliseconds_should_always_be_deserialized_correctly_by_TypeSerializer()
{
var dateWithoutMillisecondsUtc = new DateTime(2013, 4, 9, 15, 20, 0, DateTimeKind.Utc);
var dateWithoutMillisecondsLocal = new DateTime(2013, 4, 9, 15, 20, 0, DateTimeKind.Local);
var dateWithoutMillisecondsUnspecified = new DateTime(2013, 4, 9, 15, 20, 0, DateTimeKind.Unspecified);

string serialized = null;
DateTime deserialized;

serialized = TypeSerializer.SerializeToString(dateWithoutMillisecondsUtc);
deserialized = TypeSerializer.DeserializeFromString(serialized);
Assert.AreEqual(dateWithoutMillisecondsUtc, deserialized);

serialized = TypeSerializer.SerializeToString(dateWithoutMillisecondsLocal);
deserialized = TypeSerializer.DeserializeFromString(serialized);
Assert.AreEqual(dateWithoutMillisecondsLocal, deserialized);

serialized = TypeSerializer.SerializeToString(dateWithoutMillisecondsUnspecified);
deserialized = TypeSerializer.DeserializeFromString(serialized);
Assert.AreEqual(dateWithoutMillisecondsUnspecified, deserialized);
}

without the fix, Local or Unspecified DateTime values without milliseconds would be deserialized in their UTC form instead of their original form.