Skip to content

Commit

Permalink
fix(analytics): add to and from dates to campaign analytics URL (knad…
Browse files Browse the repository at this point in the history
…h#1952)

Co-authored-by: Adrian Moya <adrian@csma.tehcnology>
  • Loading branch information
admoya and Adrian Moya authored Jul 25, 2024
1 parent 23d236f commit 45f1f80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/src/views/CampaignAnalytics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export default Vue.extend({
},
onSubmit() {
this.$router.push({ query: { id: this.form.campaigns.map((c) => c.id) } });
this.$router.push({ query: { id: this.form.campaigns.map((c) => c.id), from: dayjs(this.form.from).unix(), to: dayjs(this.form.to).unix() } });
},
queryCampaigns(q) {
Expand Down Expand Up @@ -300,8 +300,11 @@ export default Vue.extend({
created() {
const now = dayjs().set('hour', 23).set('minute', 59).set('seconds', 0);
this.form.to = now.toDate();
this.form.from = now.subtract(7, 'day').set('hour', 0).set('minute', 0).toDate();
const weekAgo = now.subtract(7, 'day').set('hour', 0).set('minute', 0);
const from = this.$route.query.from ? dayjs.unix(this.$route.query.from) : weekAgo;
const to = this.$route.query.to ? dayjs.unix(this.$route.query.to) : now;
this.form.from = from.toDate();
this.form.to = to.toDate();
},
mounted() {
Expand Down

0 comments on commit 45f1f80

Please sign in to comment.