Skip to Main Content
Hands-On Full Stack Web Development with Aurelia
book

Hands-On Full Stack Web Development with Aurelia

by Diego Argüelles Rojas, Erikson Murrugarra Murrugarra Sifuentes
June 2018
Intermediate to advanced content levelIntermediate to advanced
348 pages
8h 19m
English
Packt Publishing
Content preview from Hands-On Full Stack Web Development with Aurelia

The problem – Data is not exposed as we need

One of the common problems we could have is the date formatting. In other code languages such as Java, you have a utility class like SimpleDateFormat, which converts the Date() object to a more friendly human reading format. In JavaScript, we have some libraries to do that job, but they are not so simple to call. Let's see an example.

You get the current date in your ViewModel component; then, you pass that value to the View layer:

export class Example {
      constructor() {
        this.changeDate();
        setInterval(() => this.changeDate(), 3000); //<<-- This method will be executed each 3 seconds
      }

      changeDate() {
        this.currentDate = new Date(); //<<-- Get the current date
      }
}

In our View file, we map the currentDate ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Front-End Tooling with Gulp, Bower, and Yeoman

Front-End Tooling with Gulp, Bower, and Yeoman

Stefan Baumgartner
Ember.js in Action

Ember.js in Action

Joachim Haagen Skeie

Publisher Resources

ISBN: 9781788833202Supplemental Content