Skip to content

Commit 0df4246

Browse files
authored
Merge pull request #27 from sadespresso:master
Release 3.0.0
2 parents 06a19ce + d9a1ed0 commit 0df4246

17 files changed

+222
-49
lines changed

.markdownlint.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"MD013": {
3-
"line_length": 80
4-
}
2+
"MD013": false,
3+
"MD041": false
54
}

CHANGELOG.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 3.0.0
2+
3+
> This release has breaking changes!
4+
5+
- Changed `TimeRange.toString()` delimiter to `@`
6+
- Fixed CustomTimeRange not being able to be parsed
7+
- Added `.encode()` and `.encodeShort()` methods on `TimeRange`
8+
- Added `TimeRange.fromStartAndDuration` constructor
9+
110
## 2.2.1
211

312
- Added `TimeRange` readable format.
@@ -67,7 +76,7 @@
6776

6877
## 1.1.0
6978

70-
- `.startOf(DurationUnit.week)` and `endOf` now works, fixes [#13](https://github.com/sadespresso/moment_dart/issues/13)
79+
- `.startOf(DurationUnit.week)` and `endOf` now works, fixes [#13](https://github.com/sadespresso/moment_dart/issues/13)
7180

7281
## 1.0.1
7382

@@ -76,6 +85,7 @@
7685
## 1.0.0
7786

7887
> Features **breaking changes**
88+
7989
- Now requires Dart v2.19.4
8090
- Added {reference} argument to `ComplexCalendar` methods
8191
- This fixes incorrect results of localizations that use `ComplexCalender` (i.e., zh_CN, it_IT)
@@ -96,6 +106,7 @@
96106
## 1.0.0-rc.1
97107

98108
> Features **breaking changes**
109+
99110
- Added {reference} argument to `ComplexCalendar` methods
100111
- This fixes incorrect results of localizations that use `ComplexCalender` (i.e., zh_CN, it_IT)
101112
- Renamed `LocalizationKo` to `LocalizationKoKr` for consistency
@@ -157,6 +168,7 @@
157168
## 0.16.0
158169

159170
> This release has breaking changes!
171+
160172
- `Duration().toDurationString()` first argument is now **named**, and ***optional***. When null, uses global localization set using `Moment.setGlobalLocalization(MomentLocalization)`
161173
- Now `weekStart` of `DateTime().startOfLocalWeek([int weekStart])` is nullable, and defaults to `Moment.defaultLocalization.weekStart`
162174
- Now `weekStart` of `DateTime().endOfLocalWeek([int weekStart])` is nullable, and defaults to `Moment.defaultLocalization.weekStart`
@@ -169,19 +181,22 @@
169181
## 0.14.0
170182

171183
> This release has breaking changes!
184+
172185
- [BREAKING] moment.format("YY") now **no longer throws exception** when year doesn't fall in range (1970, 2030). Instead, it returns full year. e.g., `DateTime(1969).format("YY"); // 1969`
173186
- [BREAKING] moment.format("gg") now **no longer throws exception** when ISO week year doesn't fall in range (1970, 2030). Instead, it returns full year. e.g., `DateTime(1969).format("gg"); // 1969`
174187
- [BREAKING] `DateTime.format(...)` now expect named arguments instead of optional positional arguments
175188

176189
## 0.13.0
177190

178191
> This release has breaking changes!
179-
- [BREAKING] `endOf_()` and `startOf_()` now _preserves_ the timezone instead of always returning local `DateTime` object
192+
193+
- [BREAKING] `endOf_()` and `startOf_()` now *preserves* the timezone instead of always returning local `DateTime` object
180194
- `endOf(DurationUnit.microsecond)` and `startOf(DurationUnit.microsecond)` now returns `this.clone()` instead of throwing error
181195

182196
## 0.12.0
183197

184198
> This release has breaking changes!
199+
185200
- [BREAKING] `isAtSameUnit___As(other)` now doesn't take timezones into account. If you want the old behaviour, use `isAtSameUnit___As(other, enforceUTC: true)`
186201
- [BREAKING] Renamed `MomentLocalizations.deDE()` to `.de()`
187202
- [BREAKING] Removed `Moment().elapsed()` for sake of `Moment().fromPrecise()`
@@ -259,7 +274,7 @@
259274
- Restructured formatters. No need to override formatter for every `FormatterToken`
260275
- Removed following deprecated methods: `Moment.lastMondayAsDateTime()`, `Moment.lastSundayAsDateTime()`
261276
- Implemented `.endOf(DurationUnit unit)`, and it's children `.endOf~~~()`. Works on both `Moment` and `DateTime`
262-
- Added new locales:
277+
- Added new locales:
263278
- Spanish (es) (Spain)
264279
- French (fr) (France)
265280
- Minor changes:

lib/src/localizations/de_DE.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ class LocalizationDeDe extends MomentLocalization
243243
thisYear: "Dieses Jahr",
244244
year: (range) => "Jahr ${range.year}",
245245
month: (range) => monthNames[range.month]!,
246-
customRangeAfter: (formattedDate) => "Nach $formattedDate",
247-
customRangeBefore: (formattedDate) => "Vor $formattedDate",
246+
allAfter: (formattedDate) => "Nach $formattedDate",
247+
allBefore: (formattedDate) => "Vor $formattedDate",
248248
customRangeAllTime: "Allzeit",
249249
);
250250
}

lib/src/localizations/en_US.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ class LocalizationEnUs extends MomentLocalization
213213
thisYear: "This year",
214214
year: (range) => "Year ${range.year}",
215215
month: (range) => monthNames[range.month]!,
216-
customRangeAfter: (formattedDate) => "After $formattedDate",
217-
customRangeBefore: (formattedDate) => "Before $formattedDate",
216+
allAfter: (formattedDate) => "After $formattedDate",
217+
allBefore: (formattedDate) => "Before $formattedDate",
218218
customRangeAllTime: "All time",
219219
);
220220
}

lib/src/localizations/es_ES.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ class LocalizationEsEs extends MomentLocalization
223223
thisYear: "Este año",
224224
year: (range) => "Año ${range.year}",
225225
month: (range) => monthNames[range.month]!,
226-
customRangeAfter: (formattedDate) => "Después $formattedDate",
227-
customRangeBefore: (formattedDate) => "Antes $formattedDate",
226+
allAfter: (formattedDate) => "Después $formattedDate",
227+
allBefore: (formattedDate) => "Antes $formattedDate",
228228
customRangeAllTime: "Todo el tiempo",
229229
);
230230
}

lib/src/localizations/fr_FR.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ class LocalizationFrFr extends MomentLocalization
230230
thisYear: "Cette année",
231231
year: (range) => "Année ${range.year}",
232232
month: (range) => monthNames[range.month]!,
233-
customRangeAfter: (formattedDate) => "Après $formattedDate",
234-
customRangeBefore: (formattedDate) => "Avant $formattedDate",
233+
allAfter: (formattedDate) => "Après $formattedDate",
234+
allBefore: (formattedDate) => "Avant $formattedDate",
235235
customRangeAllTime: "Tout le temps",
236236
);
237237
}

lib/src/localizations/it_IT.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ class LocalizationItIt extends MomentLocalization
229229
thisYear: "Quest'anno",
230230
year: (range) => "Anno ${range.year}",
231231
month: (range) => monthNames[range.month]!,
232-
customRangeAfter: (formattedDate) => "Dopo $formattedDate",
233-
customRangeBefore: (formattedDate) => "Prima di $formattedDate",
232+
allAfter: (formattedDate) => "Dopo $formattedDate",
233+
allBefore: (formattedDate) => "Prima di $formattedDate",
234234
customRangeAllTime: "Tutto il tempo",
235235
);
236236
}

lib/src/localizations/ja_JP.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ class LocalizationJaJp extends MomentLocalization
182182
thisYear: "今年",
183183
year: (range) => "${range.year}年",
184184
month: (range) => monthName(range.month),
185-
customRangeAfter: (formattedDate) => "$formattedDate以降",
186-
customRangeBefore: (formattedDate) => "$formattedDate以前",
185+
allAfter: (formattedDate) => "$formattedDate以降",
186+
allBefore: (formattedDate) => "$formattedDate以前",
187187
customRangeAllTime: '全ての時間',
188188
);
189189
}

lib/src/localizations/ko_KR.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ class LocalizationKoKr extends MomentLocalization
152152
thisYear: "올해",
153153
year: (range) => "${range.year}년",
154154
month: (range) => monthName(range.month),
155-
customRangeAfter: (formattedDate) => "$formattedDate 이후",
156-
customRangeBefore: (formattedDate) => "$formattedDate 이전",
155+
allAfter: (formattedDate) => "$formattedDate 이후",
156+
allBefore: (formattedDate) => "$formattedDate 이전",
157157
customRangeAllTime: "전체 시간",
158158
);
159159
}

lib/src/localizations/mixins/simple_range.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class SimpleRangeData {
1616
///
1717
/// For example, in en_US,
1818
/// (formattedDate) => "After $formattedDate"
19-
final String Function(String formattedDate) customRangeAfter;
19+
final String Function(String formattedDate) allAfter;
2020

2121
/// When start date equals [Moment.minValue]
2222
///
2323
/// For example, in en_US,
2424
/// (formattedDate) => "Before $formattedDate"
25-
final String Function(String formattedDate) customRangeBefore;
25+
final String Function(String formattedDate) allBefore;
2626

2727
/// When range [from] is equal to [Moment.minValue] and
2828
/// [to] is equal to [Moment.maxValue]
@@ -50,8 +50,8 @@ class SimpleRangeData {
5050
required this.thisYear,
5151
required this.year,
5252
required this.month,
53-
required this.customRangeAfter,
54-
required this.customRangeBefore,
53+
required this.allAfter,
54+
required this.allBefore,
5555
required this.customRangeAllTime,
5656
this.customRangeDelimiter = " - ",
5757
this.reverseRangeDates = false,
@@ -102,14 +102,14 @@ mixin SimpleRange on MomentLocalization {
102102
.toMoment(localization: localization)
103103
.calendar(omitHours: custom.from.isMidnight, reference: anchor);
104104

105-
return localization.simpleRangeData.customRangeAfter(formattedDate);
105+
return localization.simpleRangeData.allAfter(formattedDate);
106106
}
107107
if (custom.from == Moment.minValue) {
108108
final String formattedDate = custom.to
109109
.toMoment(localization: localization)
110110
.calendar(omitHours: custom.to.isMidnight, reference: anchor);
111111

112-
return localization.simpleRangeData.customRangeBefore(formattedDate);
112+
return localization.simpleRangeData.allBefore(formattedDate);
113113
}
114114

115115
final bool omitHours = custom.from.isMidnight && custom.to.isMidnight;

lib/src/localizations/mn_MN.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class LocalizationMnMn extends MomentLocalization
150150
thisYear: "Энэ жил",
151151
year: (range) => "${range.year} он",
152152
month: (range) => monthName(range.month),
153-
customRangeAfter: (formattedDate) => "$formattedDate-с хойш",
154-
customRangeBefore: (formattedDate) => "$formattedDate-с өмнө",
153+
allAfter: (formattedDate) => "$formattedDate-с хойш",
154+
allBefore: (formattedDate) => "$formattedDate-с өмнө",
155155
customRangeAllTime: "Бүх цаг үе",
156156
);
157157
}

lib/src/localizations/mn_Mong_MN.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ class LocalizationMnMongMn extends MomentLocalization
184184
thisYear: "ᠡᠨᠡ ᠵᠢᠯ",
185185
year: (range) => "${range.year} ᠣᠨ",
186186
month: (range) => monthName(range.month),
187-
customRangeAfter: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠬᠣᠢᠢᠰᠢ",
188-
customRangeBefore: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠡᠮᠥᠨ᠎ᠡ",
187+
allAfter: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠬᠣᠢᠢᠰᠢ",
188+
allBefore: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠡᠮᠥᠨ᠎ᠡ",
189189
customRangeAllTime: "ᠪᠦᠬᠦ ᠴᠠᠭ ᠦᠢ᠎ᠡ",
190190
);
191191
}
@@ -290,8 +290,8 @@ class LocalizationMnQaaqMn extends LocalizationMnMongMn with Ordinal {
290290
thisYear: "ᠡᠨᠡ ᠵᠢᠯ",
291291
year: (range) => "${toTraditionalNumber(range.year.toString())} ᠣᠨ",
292292
month: (range) => monthName(range.month),
293-
customRangeAfter: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠬᠣᠢᠢᠰᠢ",
294-
customRangeBefore: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠡᠮᠥᠨ᠎ᠡ",
293+
allAfter: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠬᠣᠢᠢᠰᠢ",
294+
allBefore: (formattedDate) => "$formattedDate ᠡᠴᠡ ᠡᠮᠥᠨ᠎ᠡ",
295295
customRangeAllTime: "ᠪᠦᠬᠦ ᠴᠠᠭ ᠦᠢ᠎ᠡ",
296296
);
297297
}

lib/src/localizations/pt_PT.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ class LocalizationPtPt extends MomentLocalization
239239
thisYear: "Este ano",
240240
year: (range) => "Ano ${range.year}",
241241
month: (range) => monthNames[range.month]!,
242-
customRangeAfter: (formattedDate) => "Após $formattedDate",
243-
customRangeBefore: (formattedDate) => "Antes de $formattedDate",
242+
allAfter: (formattedDate) => "Após $formattedDate",
243+
allBefore: (formattedDate) => "Antes de $formattedDate",
244244
customRangeAllTime: "Todo o tempo",
245245
);
246246
}

lib/src/localizations/zh_CN.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ class LocalizationZhCn extends MomentLocalization
211211
thisYear: "今年",
212212
year: (range) => "${range.year}年",
213213
month: (range) => monthNames[range.month]!,
214-
customRangeAfter: (formattedDate) => "$formattedDate之后",
215-
customRangeBefore: (formattedDate) => "$formattedDate之前",
214+
allAfter: (formattedDate) => "$formattedDate之后",
215+
allBefore: (formattedDate) => "$formattedDate之前",
216216
customRangeAllTime: "全部时间", // All time
217217
);
218218
}

0 commit comments

Comments
 (0)