Skip to content

Commit 1f2b759

Browse files
dimircCameron Knight
authored and
Cameron Knight
committed
refactor(dateFilter): improve readability on conditional assignment
Use ternary operator instead of if statement Closes angular#5065
1 parent 4705a29 commit 1f2b759

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/ng/filter/filters.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,7 @@ function dateFilter($locale) {
442442
format = format || 'mediumDate';
443443
format = $locale.DATETIME_FORMATS[format] || format;
444444
if (isString(date)) {
445-
if (NUMBER_STRING.test(date)) {
446-
date = int(date);
447-
} else {
448-
date = jsonStringToDate(date);
449-
}
445+
date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date);
450446
}
451447

452448
if (isNumber(date)) {

0 commit comments

Comments
 (0)