Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

startDateLabel populated #1644

Merged
merged 3 commits into from Sep 22, 2020
Merged

startDateLabel populated #1644

merged 3 commits into from Sep 22, 2020

Conversation

umuur
Copy link
Contributor

@umuur umuur commented Jul 18, 2020

closes #12014

-startDateLabel variable populated in order to show start date for the members chart.

  • There's a clear use-case for this code change
  • Commit message has a short title & references relevant issues
  • The build will pass (run ember test from the repo root - will be core/client if working from the submodule in Ghost).

More info can be found by clicking the "guidelines for contributing" link above.

Comment on lines 21 to 22
startDateLabel: computed('membersStats.days', function () {
return moment(new Date()).add(-this.membersStats.days + 1, 'days').format(DATE_FORMAT);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't work when the "All time" range is chosen because memberStats.days will be "all-time" and not a number.

What you could do instead is to use memberStats.stats as the dependent key and use Object.keys(memberStats.stats.total_on_date)[0] to grab the first date in the range and build the label from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, thank you for that!

@kevinansfield kevinansfield merged commit b76dd44 into TryGhost:master Sep 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants