forked from loafle/openapi-generator-original
[dart] fix Date.toDateTime utc (#9717)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user