Momentjs in meteor- reactivity?

后端 未结 4 416
栀梦
栀梦 2021-01-12 16:12

Have been using https://github.com/acreeger/meteor-moment in meteor and it works well, however is there a way to make the output of moment reactive so that it counts up \"3

4条回答
  •  孤城傲影
    2021-01-12 17:13

    You can now use the package copleykj:livestamp. (github | atmosphere)

    Install it like this:

    meteor add copleykj:livestamp
    

    It has a dependency on momentjs:moment so it will bring that along automatically. It installs a universal helper that is available anywhere and can be passed a date object.

    You can use it in a template like this:

  • Regular: {{date}}
  • Livestamp: {{livestamp date}}
  • Here's a working demo in MeteorPad

提交回复
热议问题