A simple widget that's capable of displaying time for multiple locations around the world. In our company(neo), we use it to display time in different offices.
1. Download moment.js 2.5.1 from MomentJS,
2. Download moment-timezone.js 0.0.3 from Moment Timezone.
3. Build the timezone data for locations you are interested in: http://momentjs.com/timezone/data/ and save the data file as moment-timezone-data.js
. Note that for the default timezone configuration(shown below in world_clock.cofee) to work, you will need to include timezone data of Asia, America and Europe when building moment-timezone-data.js.
4. Put all the downloaded files in your /assets/javascripts
directory.
5. Include them in application.coffee
in the following order:
#= require moment.min
#= require moment-timezone.min
#= require moment-timezone-data
6. The files world_clock.coffee
, world_clock.html
and world_clock.scss
go in the /widget/world_clock
directory.
7. Last but not least, add the widget html to your dashboard:
<li data-row="1" data-col="1" data-sizex="4" data-sizey="1">
<div data-view="WorldClock" class="widget widget-world-clock"></div>
</li>
Can someone please help me to get this widget working. I am using moment.js version : 2.10.6. and moment-timezone.js version : 0.4.0. I have these 2 lines in application.coffee for debugging
console.log(moment(1369266934311).zone('+0100').format('YYYY-MM-DD HH:mm'))
console.log(moment.tz("2013-11-18 11:55", "America/Toronto"))
the first line works correctly and displays a date in console.
The second console command does not work and displays the following message
TypeError: undefined is not a function (evaluating 'moment.tz("2013-11-18 11:55", "America/Toronto")') (anonymous function) global code
can please someone help me. I am going crazy over this.