-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DateTime class relies on private members of other
objects
#32051
Comments
other
objectsother
objects
The publicly accessible members for However, |
I see. So all of the methods that access the
Any code that |
No need to go external, just change Specifying |
Ah, good idea, @lrhn. Two questions before I send a patch:
|
It probably does get in the way, but if the compare must be ready to support non-platform bool isAfter(DateTime other) {
var ms = this.millisecondsSinceEpoch;
var oms = other.millisecondsSinceEpoch;
return ms > oms || (ms == oms && this.microseconds > other.microseconds);
} but the implementation must check the microseconds of the And sure, if we can be more efficient by doing it differently on different platforms, we can go the |
|
Thanks much! |
DateTime has a few methods that rely on a private member of objects:
other
is not guaranteed to be of a class declared indart:core
, so it's_value
may be inaccessible.In practice, this means that DateTime is not implementable, a problem for the timezone package:
throws trying to call
_value
on the TZDateTime object. The docs for_value
read:I think the best solution is to make a public getter,
value
for_value
. Especially when TZDateTime is used to wrap a native DateTime, and should set its own _value to the native DateTime's _value, so that it doesn't have to use a hack likeif (identical(1, 1.0)
to make up a value.The text was updated successfully, but these errors were encountered: