title: Setting up a utility class and using it within a vue component
body: <p>A vue application I am working on currently has lots of code redundancies relating to date functions. In an effort to reduce these redundancies, I'd like to create a utility class as shown below, import it and set it to a Vue data property within the component, so I can call the date functions within it. </p>
  
  <p>I am not certain on the best way to implement this. The current implementation results in an error saying <code>TypeError: this.dates is undefined</code> and my goal is not only to resolve this error but create/utilize the class in the Vue environment using best standards.</p>
  
  <p>Importing utility class</p>
  
  <pre><code>    import Dates from "./utility/Dates";
  ...
  </code></pre>
  
  <p>Component</p>
  
  <pre><code>const contactEditView = Vue.component('contact-edit-view', {
          data() {
              return {
                  contact: this.myContact
                  dates: Dates
              }
          },
  ...
  </code></pre>
  
  <p>Dates.js</p>
  
  <pre><code>export default {
      dateSmall(date) {
          return moment(date).format('L'); 
      },
      dateMedium(date) {
          return moment(date).format('lll');
      },
      dateLarge(date) {
          return moment(date).format('LLL');
      }
  };
  </code></pre>
  
  <p>View</p>
  
  <pre><code>Date of Birth: {{ dates.dateMedium(contact.dob) }}
  </code></pre>