Skip to content

Commit 9b29c4f

Browse files
committed
0.8.0
1 parent 9226606 commit 9b29c4f

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.8.0] - 2022-02-04
9+
10+
### Added
11+
12+
- feat: add method `addRound` to prevent date overflow by @g1eny0ung in <https://github.com/dayjs/day.dart/pull/41>
13+
- feat: add method `subtractRound` to prevent date overflow by @g1eny0ung in <https://github.com/dayjs/day.dart/pull/42>
14+
15+
### Changed
16+
17+
- chore!: now `.add()` and `.subtract()` return nullable
18+
19+
### Removed
20+
21+
- chore!: remove useless `.isValid()`
22+
823
## [0.7.2] - 2022-01-17
924

1025
- Refactor internal `Unit`

lib/src/day.dart

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class Day {
395395
return null;
396396
}
397397

398-
/// Add [val] by [unit]. Supports shorthand.
398+
/// Adds [val] by [unit]. Supports shorthand.
399399
///
400400
/// Example:
401401
///
@@ -405,18 +405,18 @@ class Day {
405405
/// ```
406406
Day? add(int val, String unit) => _add(val: val, unit: unit);
407407

408-
/// Add [val] by [unit] but rounded. Supports shorthand.
408+
/// Adds [val] by [unit] but rounded. Supports shorthand.
409409
///
410410
/// Example:
411411
///
412412
/// ```dart
413413
/// addRound(1, 'month');
414-
/// add(1, 'M');
414+
/// addRound(1, 'M');
415415
/// ```
416416
Day? addRound(int val, String unit) =>
417417
_add(val: val, unit: unit, rounded: true);
418418

419-
/// Subtract [val] by [unit]. Supports shorthand.
419+
/// Subtracts [val] by [unit]. Supports shorthand.
420420
///
421421
/// Example:
422422
///
@@ -427,14 +427,22 @@ class Day {
427427
Day? subtract(int val, String unit) =>
428428
_add(val: val, unit: unit, opposite: true);
429429

430+
/// Subtracts [val] by [unit] but rounded. Supports shorthand.
431+
///
432+
/// Example:
433+
///
434+
/// ```dart
435+
/// subtractRound(1, 'month');
436+
/// subtractRound(1, 'M');
437+
/// ```
430438
Day? subtractRound(int val, String unit) =>
431439
_add(val: val, unit: unit, opposite: true, rounded: true);
432440

433441
/// Alias of [add].
434-
dynamic inc(int val, String unit) => add(val, unit);
442+
Day? inc(int val, String unit) => add(val, unit);
435443

436444
/// Alias of [subtract].
437-
dynamic dec(int val, String unit) => subtract(val, unit);
445+
Day? dec(int val, String unit) => subtract(val, unit);
438446

439447
/// Format the [Day]'s displaying.
440448
///

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: day
2-
version: 0.7.2
2+
version: 0.8.0
33
description: >-
44
A date library Day.js in dart.
55
Day.dart is inspired by Day.js.

0 commit comments

Comments
 (0)