[dart] fix Date.toDateTime utc (#9717)

This commit is contained in:
FallenRiteMonk
2021-06-10 05:11:08 +02:00
committed by GitHub
parent 99994945c7
commit 6611ae64bb
2 changed files with 8 additions and 6 deletions

View File

@@ -24,9 +24,10 @@ class Date implements Comparable<Date> {
/// Convert to a [DateTime].
DateTime toDateTime({bool utc = false}) {
if (utc) {
DateTime.utc(year, month, day);
return DateTime.utc(year, month, day);
} else {
return DateTime(year, month, day);
}
return DateTime(year, month, day);
}
@override
@@ -66,4 +67,4 @@ class Date implements Comparable<Date> {
extension DateTimeToDate on DateTime {
Date toDate() => Date(year, month, day);
}
}

View File

@@ -24,9 +24,10 @@ class Date implements Comparable<Date> {
/// Convert to a [DateTime].
DateTime toDateTime({bool utc = false}) {
if (utc) {
DateTime.utc(year, month, day);
return DateTime.utc(year, month, day);
} else {
return DateTime(year, month, day);
}
return DateTime(year, month, day);
}
@override
@@ -66,4 +67,4 @@ class Date implements Comparable<Date> {
extension DateTimeToDate on DateTime {
Date toDate() => Date(year, month, day);
}
}