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>
Awesome job on the Widget, love it.
Git one problem though, when cycling through Dashboards (sinatra cycle or switcher) sometimes the Clock doesn't load when it reach the first page again. (Numbers appear but the Timezones/Actual time doesn't show up).
Do you have an Idea why is this like this?