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>
Thanks @weilu, this is really nice! A pretty unique display of time zones, I like it a lot!
Thanks @BillLortz for the post about the timezone files etc. This was what got everything finally working for me here.
@weilu, a suggestion perhaps: Can you consider having the Time zone tags be alternated high/low when they are very close? Currently they just overlap. For example, it would be cool when it can be detected that they overlap, to do something like this:
Nice work!
Bill