-
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
Date class should be split into Date and Timestamp #1424
Comments
This comment was originally written by ladicek@gmail.com Yes! Yes please, at least separated Date and DateTime (and possibly Time). I hope this will get particular attention, because date libraries are both hard and important. |
cc @floitschG. |
This comment was originally written by @ahmetaa The current implementation of Java Date/Time API worth a check. It has been under development for a long time and lead developer Stephen Coleborne is an expert on this issue. I would recommend Dart Team to at least have a look at the API or even request an informal review from him. He is very keen on new languages as well (If I am not mistaken he involved Date/Time API design of Fantom language as well).
|
A complete date library (like Joda) is definitely to complicated to be in the core-library. In some sense that leaves us with a simplified (some would say "crippled") Date library. The question is how much we should simplify it. There is now a push to remove the TimeZone class too. The reasoning is that anything except local dates (and maybe UTC dates) is out of the scope of a simplified date-library and would need to be treated by a specialized library (like Joda) anyways. |
This comment was originally written by martinp...@google.com I've seen a lot of Java applications burnt by the terrible java.util.Date and java.util.Calendar APIs, so I think getting this right and having good support for Date operations in the standard library is quite important. Maybe call this timezone-less entity Timestamp, or Instant (in Joda time terminology)? Do you expect a third party to deliver that date/time support library? Or will this come as part of Dart? |
This comment was originally written by @ahmetaa JSR-310 has LocalDate, LocalDateTime and LocalTime for that. http://threeten.sourceforge.net/apidocs/javax/time/calendar/LocalDate.html But i see the reasoning not to bloat the core APIs so i stop spamming. |
We liberated the Added NotPlanned label. |
This CL moves write-barrier checking code into stub for binary size reduction. ``` before ;; StoreInstanceField(v11 . start = v15) 0x101d0040c b801b020 strw r0, [r1, dart-lang#27] 0x101d00410 36000100 tbzw r0, #0, 0x101d00430 0x101d00414 385ff030 ldrb ip0, [r1, #-1] 0x101d00418 385ff011 ldrb ip1, [r0, #-1] 0x101d0041c 8a500a30 and ip0, ip1, ip0 lsr dart-lang#2 0x101d00420 ea5c821f ands zr, ip0, r28 lsr dart-lang#32 0x101d00424 54000060 beq 0x101d00430 0x101d00428 f942cb5e ldr lr, [r26, dart-lang#1424] 0x101d0042c d63f03c0 blr lr ;; ParallelMove r0 <- r4 0x101d00430 aa0403e0 mov r0, r4 ;; StoreInstanceField(v11 . end = v17) 0x101d00434 b801f020 strw r0, [r1, dart-lang#31] 0x101d00438 36000100 tbzw r0, #0, 0x101d00458 0x101d0043c 385ff030 ldrb ip0, [r1, #-1] 0x101d00440 385ff011 ldrb ip1, [r0, #-1] 0x101d00444 8a500a30 and ip0, ip1, ip0 lsr dart-lang#2 0x101d00448 ea5c821f ands zr, ip0, r28 lsr dart-lang#32 0x101d0044c 54000060 beq 0x101d00458 0x101d00450 f942cb5e ldr lr, [r26, dart-lang#1424] 0x101d00454 d63f03c0 blr lr ``` ``` after ;; StoreInstanceField(v11 . start = v15) 0x10a6003cc b801b020 strw r0, [r1, dart-lang#27] 0x10a6003d0 f942cb5e ldr lr, [r26, dart-lang#1424] 0x10a6003d4 d63f03c0 blr lr ;; ParallelMove r0 <- r4 0x10a6003d8 aa0403e0 mov r0, r4 ;; StoreInstanceField(v11 . end = v17) 0x10a6003dc b801f020 strw r0, [r1, dart-lang#31] 0x10a6003e0 f942cb5e ldr lr, [r26, dart-lang#1424] 0x10a6003e4 d63f03c0 blr lr ```
This CL moves write-barrier checking code into stub for binary size reduction. ``` before ;; StoreInstanceField(v11 . start = v15) 0x101d0040c b801b020 strw r0, [r1, dart-lang#27] 0x101d00410 36000100 tbzw r0, #0, 0x101d00430 0x101d00414 385ff030 ldrb ip0, [r1, #-1] 0x101d00418 385ff011 ldrb ip1, [r0, #-1] 0x101d0041c 8a500a30 and ip0, ip1, ip0 lsr dart-lang#2 0x101d00420 ea5c821f ands zr, ip0, r28 lsr dart-lang#32 0x101d00424 54000060 beq 0x101d00430 0x101d00428 f942cb5e ldr lr, [r26, dart-lang#1424] 0x101d0042c d63f03c0 blr lr ;; ParallelMove r0 <- r4 0x101d00430 aa0403e0 mov r0, r4 ;; StoreInstanceField(v11 . end = v17) 0x101d00434 b801f020 strw r0, [r1, dart-lang#31] 0x101d00438 36000100 tbzw r0, #0, 0x101d00458 0x101d0043c 385ff030 ldrb ip0, [r1, #-1] 0x101d00440 385ff011 ldrb ip1, [r0, #-1] 0x101d00444 8a500a30 and ip0, ip1, ip0 lsr dart-lang#2 0x101d00448 ea5c821f ands zr, ip0, r28 lsr dart-lang#32 0x101d0044c 54000060 beq 0x101d00458 0x101d00450 f942cb5e ldr lr, [r26, dart-lang#1424] 0x101d00454 d63f03c0 blr lr ``` ``` after ;; StoreInstanceField(v11 . start = v15) 0x10a6003cc b801b020 strw r0, [r1, dart-lang#27] 0x10a6003d0 f942cb5e ldr lr, [r26, dart-lang#1424] 0x10a6003d4 d63f03c0 blr lr ;; ParallelMove r0 <- r4 0x10a6003d8 aa0403e0 mov r0, r4 ;; StoreInstanceField(v11 . end = v17) 0x10a6003dc b801f020 strw r0, [r1, dart-lang#31] 0x10a6003e0 f942cb5e ldr lr, [r26, dart-lang#1424] 0x10a6003e4 d63f03c0 blr lr ```
This issue was originally filed by martinp...@google.com
Dart's Date class conflates the concept of a Date, i.e. YYYY-MM-DD, and a Timestamp, i.e. a Date that also includes time components.
Date libraries tend to be surprisingly complicated, but I think the Joda time library has effectively solved the issue in Java land.
http://joda-time.sourceforge.net/
It might be overly complex for something in the standard library, in particular when browsers don't have a time zone database, but the split in DateTime and LocalDate makes a lot of sense.
The text was updated successfully, but these errors were encountered: