From 4f84643999729fe2edb7a62ea8f0fa39babdf5f7 Mon Sep 17 00:00:00 2001 From: Katie Rischpater <98350084+the-bay-kay@users.noreply.github.com> Date: Wed, 4 Oct 2023 09:40:35 -0700 Subject: [PATCH] Fixed JSON Object Dump As per issue #994, fixed the `Download JSON Dump`. The previous date-picker formatted the input as 'dd MMM yyyy', used luxon to format the object. This is a bit hacky - going to rewrite the 'ControlHelper' service, and completely remove the `moment()` altogether. --- www/js/services.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/www/js/services.js b/www/js/services.js index 0c9c6e2ac..cea063f60 100644 --- a/www/js/services.js +++ b/www/js/services.js @@ -2,6 +2,7 @@ import angular from 'angular'; import { getRawEntries } from './commHelper'; +import { DateTime } from 'luxon'; angular.module('emission.services', ['emission.plugin.logger']) @@ -114,8 +115,9 @@ angular.module('emission.services', ['emission.plugin.logger']) var fmt = "YYYY-MM-DD"; // We are only retrieving data for a single day to avoid // running out of memory on the phone - var startMoment = moment(startTs); - var endMoment = moment(startTs).endOf("day"); + var adjustedTs = DateTime.fromJSDate(startTs).toFormat('dd MMM yyyy'); + var startMoment = moment(adjustedTs); + var endMoment = moment(adjustedTs).endOf("day"); var dumpFile = startMoment.format(fmt) + "." + endMoment.format(fmt) + ".timeline";