[Solved] Shouldn't the package momentjs:moment be Tracker reactive?


I am not able to get momentjs:moment to react immediately to i18n changes.

I have a drop down list generated from available languages that I get from tap:i18n. The user can use the drop-down to pick a different session language if they don’t want the one derived from their browser settings.

When a choice is made using the drop-down, the entire page changes to the new language wonderfully fast, EXCEPT the dates. They only change when I turn to a new page in my app and then turn back again.

In the drop-down event handler I set the new language like this :


I am concerned that the official package momentjs:moment ought to support Tracker, but does not.

If It does not support it, and should not support it, what do I need to do to get the same reactivity from moment.locale(lang); as I do from TAPi18n.setLanguage(lang);?

If It does support it, where can I find an example that shows how to configure it properly?


As far as I am aware, the default moment js library is not reactive.

To achieve what you want with the reactive language changes you can look at this code here: https://github.com/lb-/moment-helpers/blob/master/common.js

It is a PR by someone on my package to achieve a similar goal I believe.

If you want reactive times, you can see line 22 of that code does that also.

This package may help with what you want to do by the looks of it anyway `lbee:moment-helpers’ https://atmospherejs.com/lbee/moment-helpers


Holy cats! Isn’t the Meteor ecosystem amazing!?

I’ll try this in the morning, Thank you very much.


Splendid! That does the job wonderfully.