Skip to content

Commit

Permalink
Merge pull request #241 from desmondgc/roundtrip
Browse files Browse the repository at this point in the history
Use round-trip format specifier for DateTime
  • Loading branch information
tmenier authored Nov 28, 2017
2 parents 86b041e + 26e53f5 commit 7a3da84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Flurl/Util/CommonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public static IEnumerable<KeyValuePair<string, object>> ToKeyValuePairs(this obj
/// </summary>
public static string ToInvariantString(this object obj) {
// inspired by: http://stackoverflow.com/a/19570016/62600

var d = obj as DateTime?;
if (d != null)
return d.Value.ToString("O", CultureInfo.InvariantCulture);

#if !NETSTANDARD1_0
var c = obj as IConvertible;
Expand Down Expand Up @@ -124,4 +128,4 @@ public static void Merge<TKey, TValue>(this IDictionary<TKey, TValue> d1, IDicti
d1.Add(kv);
}
}
}
}

0 comments on commit 7a3da84

Please sign in to comment.