diff options
author | crupest <crupest@outlook.com> | 2020-08-11 18:22:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 18:22:43 +0800 |
commit | 8999e174b984938760b020e08b9b9d1e886a6941 (patch) | |
tree | 20bfb96ab9935d96d5ea15b2fb89348bcd941ebf /Timeline/Helpers/DateTimeExtensions.cs | |
parent | d529b53530270cd7c5d9a90ebcb11e49f7b1eb0d (diff) | |
parent | ed0e023e2eb2cc297ea0d60ea3f20c12ad83cfa8 (diff) | |
download | timeline-8999e174b984938760b020e08b9b9d1e886a6941.tar.gz timeline-8999e174b984938760b020e08b9b9d1e886a6941.tar.bz2 timeline-8999e174b984938760b020e08b9b9d1e886a6941.zip |
Merge pull request #146 from crupest/fix-141
Fix #141 .
Diffstat (limited to 'Timeline/Helpers/DateTimeExtensions.cs')
-rw-r--r-- | Timeline/Helpers/DateTimeExtensions.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Timeline/Helpers/DateTimeExtensions.cs b/Timeline/Helpers/DateTimeExtensions.cs new file mode 100644 index 00000000..374f3bc9 --- /dev/null +++ b/Timeline/Helpers/DateTimeExtensions.cs @@ -0,0 +1,14 @@ +using System;
+
+namespace Timeline.Helpers
+{
+ public static class DateTimeExtensions
+ {
+ public static DateTime MyToUtc(this DateTime dateTime)
+ {
+ if (dateTime.Kind == DateTimeKind.Utc) return dateTime;
+ if (dateTime.Kind == DateTimeKind.Local) return dateTime.ToUniversalTime();
+ return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);
+ }
+ }
+}
|