forked from DMPRoadmap/roadmap
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reverted the TimeagoFactory.js.erb to a pure .js file without Rails m…
…arkup
- Loading branch information
Showing
4 changed files
with
27 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import getConstant from './constants'; | ||
import { format, register } from 'timeago.js'; | ||
|
||
const TimeagoFactory = (() => { | ||
const defaultLocale = 'en' | ||
|
||
const convertTime = (currentLocale, el) => { | ||
return format($(el).attr('datetime'), `${currentLocale}`); | ||
}; | ||
|
||
return { | ||
render: (el) => { | ||
if (el.length > 1) { | ||
// If we were passed an array of JQuery elements then handle each one | ||
$(el).each((idx, e) => { | ||
$(e).text(convertTime(defaultLocale, e)); | ||
}); | ||
} else { | ||
$(el).text(convertTime(defaultLocale, el)); | ||
} | ||
}, | ||
}; | ||
})(); | ||
|
||
export default TimeagoFactory; |
This file was deleted.
Oops, something went wrong.