Sha256: 87d59385ec370b7f48a94e6b191c18bfb3332ea537fb8c584f01f66e604832c8

Contents?: true

Size: 875 Bytes

Versions: 14

Compression:

Stored size: 875 Bytes

Contents

import classic from "ember-classic-decorator";
import { tagName } from "@ember-decorators/component";
import { computed } from "@ember/object";
import Component from "@ember/component";
import { formatTime } from "client-app/lib/utilities";
import { later } from "@ember/runloop";

const UPDATE_INTERVAL = 60_000;

@classic
@tagName("")
export default class TimeFormatter extends Component {
  didInsertElement() {
    super.didInsertElement(...arguments);
    later(this, this.updateTime, UPDATE_INTERVAL);
  }

  @computed("timestamp")
  get title() {
    return moment(this.timestamp).format();
  }

  @computed("timestamp")
  get time() {
    return formatTime(this.timestamp);
  }

  updateTime() {
    if (this.isDestroying || this.isDestroyed) {
      return;
    }

    this.notifyPropertyChange("timestamp");
    later(this, this.updateTime, UPDATE_INTERVAL);
  }
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
logster-2.20.0 client-app/app/components/time-formatter.js
logster-2.19.1 client-app/app/components/time-formatter.js
logster-2.19.0 client-app/app/components/time-formatter.js
logster-2.18.1 client-app/app/components/time-formatter.js
logster-2.18.0 client-app/app/components/time-formatter.js
logster-2.17.1 client-app/app/components/time-formatter.js
logster-2.17.0 client-app/app/components/time-formatter.js
logster-2.16.0 client-app/app/components/time-formatter.js
logster-2.15.0 client-app/app/components/time-formatter.js
logster-2.14.0 client-app/app/components/time-formatter.js
logster-2.13.1 client-app/app/components/time-formatter.js
logster-2.13.0 client-app/app/components/time-formatter.js
logster-2.12.2 client-app/app/components/time-formatter.js
logster-2.12.1 client-app/app/components/time-formatter.js