-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine "dateFunction": momentDateFormatter" and"customCallback": populateTpl #77
Comments
I'm afraid I am not a user of moment, but it is possible in the recent Twitter changes the classname changed for the dates which means it may be returning null. Let me check. |
I can confirm Twitter Fetcher calls the function see this fiddle: https://jsfiddle.net/sxvfeza7/ There must be something not being used right with Moment in that case which is outside the scope of this project. |
Yes, above example works as intended, also over here (I have similar solution already in place). It is only when I use "dataOnly" it stops working. See the fiddle here which represents my code: https://jsfiddle.net/sxvfeza7/3/. As you can see it does not write anything in console.log. When I turn "dataonly" to false, it does work with dateFormatter. |
Ah, I see. I shall have a look at that. |
I'm not sure if it helps but I submitted a pull request for this type of situation in the past as I found the dataonly option wasn’t allowing me to format the date. I forked the Fiddle @saturday1 created and you can see my changes from line 297-320 (open to improvement) I can then format the date with out needing to load moment using some like this:
I'm using it with the CMS Joomla and I load in the current language being used so the dates are formated as needed. Cheers, |
when setting customCallback: (data) => {
const convertedData = data.map( (post) => {
const { timestamp } = post;
const unixTimestamp = new Date(timestamp).getTime() / 1000;
post.timestamp = unixTimestamp;
return post;
});
// do something with convertedData
} |
I am trying to use the template version (Example 8) combined with moment (Example 6, I think). But then I get problems with the moment js. It does not run the function at all and it does not catch the language
moment.locale('sv_SE');
. The code looks like this:You can see all HTML as well over here: https://cdn.axiell.com/dev/twitter/test/index.html
How do I run moment before the template function is running?
The text was updated successfully, but these errors were encountered: