I was recently invited to participate in developer promotion between and Amazon to publish three Amazon Echo skills. The first two skills of the project were template skills and the last one was one I had to do myself from scratch.

After throwing a few ideas around for my third skill, I asked a friend with an Echo if it could do date calculations. They said, "No". I was surprised, as it seems like something ideally suited for an ambient computing device.

What it does

Date Ninja performs date calculations with Amazon Echo, Amazon Tap, and Amazon Dot devices using the moment.js script.

Example Phrases

  • How many days is it until December 25, 2016?
  • How many days are between today and July 4th, 2016?
  • How many years, months and days are between today and July 4th, 1776?
  • What day of the week does December 25, 2016 fall on?
  • What is the date 45 days from now?
  • What was the date 90 days ago?
  • What is the date 6 weeks from now?
  • What was the date 6 weeks ago?
  • What is the date 9 months from now?
  • What was the date 9 months ago?

How I built it

I used JavaScript to create this skill. I found JavaScript's date calculations to be a little cumbersome for what I was trying to do and I found moment.js, which made life a lot simpler.

I also found Big Nerd Ranch's posts on creating Alexa Skills to be very helpful. Special thanks for Josh Skeen for his fantastic tutorials.

Challenges I ran into

When I began this project, I knew zip about languages outside of Swift and Objective-C. Alexa Skills Kit can be programmed in Python, Java, and JavaScript. Knowing very little about those languages, JavaScript seemed like Swift with semicolons, so I went that route. Thankfully, my gut was right on the similarity between Swift and JavaScript, so the learning curve was very shallow.

It was also tough to develop a skill without having a physical device. Amazon's developer portal has a simulator where you can enter voice commands for your skill, though it's a lot easier to test with a physical device.

Accomplishments that I'm proud of

I'm very excited to develop something in JavaScript from scratch in a short span of time. This project took me a week from start-to-finish, though certification was a little trickier.

What I learned

As a result of this project, I've learned to use JavaScript, how to set up a local node.js server for testing, and how to use npm package manager

What's next for Date Ninja

Going forward, I'll update it according to user feedback.

Share this project: