Skip to content

Commit 513326a

Browse files
Merge pull request #34 from fred7francis/minor-fix-relative-date-internationalization-in-javascript
fix: for loop condition correction and return statement added
2 parents dbc4c80 + 7ecaf02 commit 513326a

File tree

1 file changed

+2
-2
lines changed
  • src/pages/2020-07/relative-time-format

1 file changed

+2
-2
lines changed

src/pages/2020-07/relative-time-format/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const DIVISIONS = [
124124
function formatTimeAgo(date) {
125125
let duration = (date - new Date()) / 1000
126126

127-
for (let i = 0; i <= DIVISIONS.length; i++) {
127+
for (let i = 0; i < DIVISIONS.length; i++) {
128128
const division = DIVISIONS[i]
129129
if (Math.abs(duration) < division.amount) {
130130
return formatter.format(Math.round(duration), division.name)
@@ -152,4 +152,4 @@ formatTimeAgo(new Date().setDate(currentDate.getDate() - 9))
152152

153153
## Conclusion
154154

155-
Internationalization is hard, but with the help of the many internationalization features in JavaScript we can do some pretty amazing stuff with internationalization without writing very much code at all.
155+
Internationalization is hard, but with the help of the many internationalization features in JavaScript we can do some pretty amazing stuff with internationalization without writing very much code at all.

0 commit comments

Comments
 (0)