Skip to content

Commit dc65204

Browse files
committed
fix(series import): extract a year when date in dd.mm.yyyy format.
Part of #1287
1 parent b859c46 commit dc65204

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic
5151
protected static final int MAX_SUPPORTED_RELEASE_YEAR = 2099;
5252

5353
// Regular expression matches release year of the stamps (from 1840 till 2099).
54+
// CheckStyle: ignore LineLength for next 2 lines
5455
private static final Pattern RELEASE_YEAR_REGEXP =
55-
Pattern.compile("(?<year>18[4-9][0-9]|19[0-9]{2}|20[0-9]{2})(г(од|\\.)?)?");
56+
Pattern.compile("([0-9]{2}\\.[0-9]{2}\\.)?(?<year>18[4-9][0-9]|19[0-9]{2}|20[0-9]{2})(г(од|\\.)?)?");
5657

5758
// Regular expression matches number of the stamps in a series (from 1 to 999).
5859
// CheckStyle: ignore LineLength for next 2 lines

src/test/groovy/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImplTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
295295
'2010год' | _
296296
'Палау 2010, 2 малых листа' | _
297297
'test,2010' | _
298+
'01.02.2010' | _
298299
}
299300

300301
@SuppressWarnings('UnnecessaryGetter')

0 commit comments

Comments
 (0)