Repository navigation
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
vlidholt
left a comment
There was a problem hiding this comment.
This is a good addition. However, it needs tests added to the connection test and serialization test, here:
https://github.com/serverpod/serverpod/blob/main/tests/serverpod_test_server/test/connection_test.dart
It also needs support for reading and writing to the database. Look at e.g. DateTime for how that is setup.
| @@ -0,0 +1,98 @@ | |||
| /// Extension for decoding [Duration] in the protocol. | |||
| extension DurationDec on String { | |||
There was a problem hiding this comment.
How about using the intl package to format the duration?
There was a problem hiding this comment.
@yahu1031 Does intl library have parser from String to Duration?
If yes, could you share the method name or link to the docs to that method?
Thank you
There was a problem hiding this comment.
You could also just use the inMicroseconds property, store the value as an int, recreate the Duration from the microseconds. That seems much better than involving the intl package.
There was a problem hiding this comment.
I am afraid that when the user wants to insert Duration(days: 9999999999), it can be stored incorrectly while inMicroseconds or inMilliSeconds are used
There was a problem hiding this comment.
2^63 - 1 is the max value of int in Dart, that should be enough, no?
There was a problem hiding this comment.
Or 584942 years. I doubt anyone use more than that for calculating dates and times.
There was a problem hiding this comment.
213503982 days * 8,64e+7 miliseconds=very big number😅
There was a problem hiding this comment.
Also, just checked. The Duration is internally stored as an int anyway. So it cannot handle any higher values.
There was a problem hiding this comment.
In that case, I have no argument )
If you request to change it to int, ill update my mr
|
I'm closing this as there is a new one with the same feature. |
Replace this paragraph with a description of what this PR is changing or adding, and why.
List which issues are fixed by this PR. You must list at least one issue.
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
If you have done any breaking changes, make sure to outline them here, so that they can be included in the notes for the next release.