For those who don't want to hard-code the Date as "$September 15, 2018" or "12:00AM". you can use intl from pub.dartlang.org
At first I did the hard-code of displaying the date & time in a proper format. then I realized that there's also a package that made it easy to code it.
This is a pretty solid representing of Dart. I feel like you can know a lot from how a language treats dates.
Pleased to see that Dart is quite sane in its API and dates/times carry around the time zone.
I still get frustrated because after many years I still have to deal with date times without a timezone in Python. From the standard library:
>>> import datetime
datetime.datetime(2018, 9, 15, 1, 51, 58, 769069)
datetime.datetime(2018, 9, 14, 23, 52, 4, 568886)
Neither the local time, now(), nor the UTC time carry the time zone so if you pass that around you're bound to mess it up, they call those "naive datetimes" vs "time zone aware datetimes" but I call them "useless datetimes" :D
No wonder Python has so many datetime libraries (each word links to a different library :D)
Thanks Sergiu. I grant that MomentJS implements some useful util methods for dates.
However the beauty here is that all these methods come inbuilt with Dart, so no extra dependencies needed.
Totally. Wish we had that for JS
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.