O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The time ago cog

Now that we have seen how the cogs are initialized on the server-side, it's time to take a look at what goes into making a cog. We're going to start out by making a very simple cog, a time ago cog, which displays time in human understandable format.

It's time revisit the gopher bios on the about page. In the section Custom template functions found in Chapter 3, Go on the Front-End with GopherJS, we learned how to use a custom template function to display the gopher's start date-time in Ruby format.

We are going to go a step further and display the start date-time in human understandable format by implementing a time ago cog. Figure 9.5 is an illustration showing the start date for Molly in the default Go format, in Ruby format, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required