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
Provide a Date manipulation library #5627
Comments
Some methods that should be in this calendar library. * what's the last day of this month (typically "first of next month - 1")
|
This comment was originally written by @seaneagan It would be awesome if this library could be on github! I would love to I think a time unit enum would be useful for a lot of these APIs: enum TimeUnit SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR; Example APIs: DateTime floor(DateTime dt, TimeUnit unit); (of course they could be instance methods on DateTime if TimeUnit were in Usage: var now = new DateTime.now(); var startOfDay = floor(now, TimeUnit.DAY); // see issue #10003 |
This comment was originally written by wshadd...@gmail.com I'd like to also request that a method to return the week # would be great. Possibly just implementing the ISO 8601 standard or giving the option to using Jan 1st as the first week. Details of the algorithm in javascript can be found at http://techblog.procurios.nl/k/news/view/33796/14863/calculate-iso-8601-week-and-year-in-javascript.html |
This comment was originally written by wsh...@gmail.com I'm just now learning the dart language so here is my first attempt at translating the javascript code to dart. Not optimized and probably buggy, but the couple of spot tests I ran seemed ok. |
I have some needs around this and have started an implementation of a Calendar/GregorianCalendar. https://github.com/dnfield/dart_calendar on pub as date_calendar |
Maybe also related to #33014? Functionality similar to Joda Time (in Java) or moment.js (in JavaScript) greatly appreciated :) |
Currently there is no good way to manipulate dates.
For example there is no good way to produce recurring dates (daily, weekly or monthly). Even worse, the intuitive approach is often wrong: date.add(new Duration(days: 1)) will not work on dates where daylight-saving is changed (going from summer to winter time or the inverse).
Ideally there should be a library that allows to easily deal with such common tasks.
The text was updated successfully, but these errors were encountered: