Skip to content

Commit 5f7c1f5

Browse files
update README w.r.t. TimeSpan support
1 parent a222b73 commit 5f7c1f5

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ The following types (and any user defined types composed of them) are supported:
9292
- Floating point numbers (float, double, and decimal)
9393
- DateTimes & DateTimeOffsets
9494
* See Configuration for further details
95+
- TimeSpans
96+
* See Configuration for further details
9597
- Nullable types
9698
- Enumerations
9799
* Including \[Flags\]
@@ -107,11 +109,19 @@ declaration order). The [`DataMemberAttribute.Name` property](http://msdn.micro
107109

108110
Jil's `JSON.Serialize` and `JSON.Deserialize` methods take an optional `Options` parameter which controls:
109111

110-
- The format of DateTimes & DateTimeOffsets, one of
111-
* NewtonsoftStyleMillisecondsSinceUnixEpoch, a string, ie. "\/Date(##...##)\/"
112-
* MillisecondsSinceUnixEpoch, a number, which can be passed directly to [JavaScript's Date() constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
113-
* SecondsSinceUnixEpoch, a number, commonly refered to as [unix time](http://en.wikipedia.org/wiki/Unix_time)
114-
* ISO8601, a string, ie. "2011-07-14T19:43:37Z"
112+
- The format of DateTimes, DateTimeOffsets, and TimeSpans; one of
113+
* NewtonsoftStyleMillisecondsSinceUnixEpoch, a string
114+
- "\/Date(##...##)\/" for DateTimes
115+
- "1.23:45:56.78" for TimeSpans
116+
* MillisecondsSinceUnixEpoch, a number
117+
- for DateTimes it can be passed directly to [JavaScript's Date() constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
118+
- for TimeSpans it's simply [TimeSpan.TotalMilliseconds](http://msdn.microsoft.com/en-us/library/system.timespan.totalmilliseconds%28v=vs.110%29.aspx)
119+
* SecondsSinceUnixEpoch, a number
120+
- for DateTimes this is commonly refered to as [unix time](http://en.wikipedia.org/wiki/Unix_time)
121+
- for TimeSpans it's simply [TimeSpan.TotalSeconds](http://msdn.microsoft.com/en-us/library/system.timespan.totalseconds%28v=vs.110%29.aspx)
122+
* ISO8601, a string
123+
- for DateTimes, ie. "2011-07-14T19:43:37Z"
124+
- for TimeSpans, ie. "P40DT11H10M9.4S"
115125
- Whether or not to exclude null values when serializing dictionaries, and object members
116126
- Whether or not to "pretty print" while serializing, which adds extra linebreaks and whitespace for presentation's sake
117127
- Whether or not the serialized JSON will be used as JSONP (which requires slightly more work be done w.r.t. escaping)

0 commit comments

Comments
 (0)