Skip to content
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

Closed
DartBot opened this issue Jan 31, 2012 · 7 comments
Closed

Date class should be split into Date and Timestamp #1424

DartBot opened this issue Jan 31, 2012 · 7 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@DartBot
Copy link

DartBot commented Jan 31, 2012

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.

@DartBot
Copy link
Author

DartBot commented Jan 31, 2012

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.

@dgrove
Copy link
Contributor

dgrove commented Feb 1, 2012

cc @floitschG.
Added Area-Library, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Feb 1, 2012

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).
JSR 310 implementation home ThreeTen:
http://sourceforge.net/apps/mediawiki/threeten/index.php?title=ThreeTen
His Blog:
http://blog.joda.org/
Fantom Date/Time API
http://fantom.org/sidewalk/topic/1202

 

@floitschG
Copy link
Contributor

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.
Initially Date was split into:
Date (YYYY-MM-DD), Time (Days, Hours, Minutes, ...), TimeZone and DateTime (being the combination of Date, Time and TimeZone). This was deemed to be too complicated and was reduced into:
Date (taking over DateTime), Duration (taking over Time) and TimeZone.

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.

@DartBot
Copy link
Author

DartBot commented Feb 1, 2012

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?

@DartBot
Copy link
Author

DartBot commented Feb 1, 2012

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.

@floitschG
Copy link
Contributor

We liberated the Date name by renaming Date to DateTime. This makes it possible to have a more complete library. See issue #5627.


Added NotPlanned label.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue labels Apr 19, 2013
kanghuay added a commit to kanghuay/sdk that referenced this issue Jun 13, 2022
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
```
kanghuay added a commit to kanghuay/sdk that referenced this issue Jun 14, 2022
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 closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

3 participants