1234567891011121314151617 |
- DateTime offsetDate(int type, int offset) {
- DateTime time = DateTime.now();
- DateTime next;
- if (type == 0) {
- next = time.add(Duration(days: offset));
- } else if (type == 1) {
- next = time.add(Duration(days: offset * 7));
- } else if (type == 2) {
- next = DateTime(time.year, time.month + offset, 1);
- } else {
- next = time.add(Duration(days: offset * 365 + 1));
- }
- return next;
- }
|