Skip to content

Commit

Permalink
Merge pull request #57 from OCTRI/minor-fixes
Browse files Browse the repository at this point in the history
Minor Fixes From Luxon Branch
  • Loading branch information
heathharrelson authored Jul 18, 2018
2 parents 4423c7d + a840cfc commit f8a4cb1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions js/components/Chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
</template>

<script>
import moment from 'moment';
import { groupedByInterval, summarizeGroups, trendPoints } from '@/bucket';
import { makeStackedChart } from '@/chart-config';
Expand All @@ -69,7 +70,6 @@ import ChartSummary from '@/components/ChartSummary';
const ALL_EVENTS = 'ALL_EVENTS';
const defaultChartEnd = new Date();
const messages = {
actions : {
confirmDelete: 'Permanently delete chart',
Expand Down Expand Up @@ -261,7 +261,7 @@ export default {
chartEnd() {
const { chartDef } = this;
return chartDef.chartEnd ? chartDef.chartEnd : defaultChartEnd;
return chartDef.chartEnd ? chartDef.chartEnd : moment().format('YYYY-MM-DD');
},
dateInterval() {
Expand Down
3 changes: 1 addition & 2 deletions js/components/ChartForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,10 @@ import {
targetsObjectWithGroups,
isoToUserDate,
userToIsoDate,
userDateFormat,
fieldLabel
} from '@/util';
const userDateFormat = 'MM/DD/YYYY';
export const selector = {
titleField: 'input[name=chart_title]',
descriptionField: 'input[name=chart_description]',
Expand Down
4 changes: 2 additions & 2 deletions js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import uuid from 'uuid/v4';
import assert from 'assert';
import moment from 'moment';

const userDateFormat = 'MM/DD/YYYY';
const isoDateFormat = 'YYYY-MM-DD';
export const userDateFormat = 'MM/DD/YYYY';
export const isoDateFormat = 'YYYY-MM-DD';

// Global for assertions
export { assert };
Expand Down
22 changes: 11 additions & 11 deletions test/bucket_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import {
import { noGroupsLabel } from '../js/util';

const data = [
{"date": "2016-10-04"}, {"date": "2016-10-04"}, {"date": "2016-10-06"}, {"date": "2016-10-06"},
{"date": "2016-10-11"}, {"date": "2016-10-11"}, {"date": "2016-10-13"}, {"date": "2016-10-18"},
{"date": "2016-10-18"}, {"date": "2016-10-20"}, {"date": "2016-10-20"}, {"date": "2016-10-25"},
{"date": "2016-10-25"}, {"date": "2016-10-27"}, {"date": "2016-11-01"}, {"date": "2016-11-01"},
{"date": "2016-11-03"}, {"date": "2016-11-03"}, {"date": "2016-11-03"}, {"date": "2016-11-08"},
{"date": "2016-11-10"}, {"date": "2016-11-10"}, {"date": "2016-11-10"}, {"date": "2016-11-15"},
{"date": "2016-11-15"}, {"date": "2016-11-17"}, {"date": "2016-11-17"}, {"date": "2016-11-17"},
{"date": "2016-12-01"}, {"date": "2016-12-06"}, {"date": "2016-12-06"}, {"date": "2016-12-08"},
{"date": "2016-12-08"}, {"date": "2016-12-13"}, {"date": "2016-12-13"}, {"date": "2016-12-13"},
{"date": "2016-12-15"}, {"date": "2016-12-15"}, {"date": "2016-12-22"}, {"date": "2016-12-29"},
{"date": "2016-12-29"}
{"date": "2016-10-04"}, {"date": "2016-10-04"}, {"date": "2016-10-06"}, {"date": "2016-10-06"},
{"date": "2016-10-11"}, {"date": "2016-10-11"}, {"date": "2016-10-13"}, {"date": "2016-10-18"},
{"date": "2016-10-18"}, {"date": "2016-10-20"}, {"date": "2016-10-20"}, {"date": "2016-10-25"},
{"date": "2016-10-25"}, {"date": "2016-10-27"}, {"date": "2016-11-01"}, {"date": "2016-11-01"},
{"date": "2016-11-03"}, {"date": "2016-11-03"}, {"date": "2016-11-03"}, {"date": "2016-11-08"},
{"date": "2016-11-10"}, {"date": "2016-11-10"}, {"date": "2016-11-10"}, {"date": "2016-11-15"},
{"date": "2016-11-15"}, {"date": "2016-11-17"}, {"date": "2016-11-17"}, {"date": "2016-11-17"},
{"date": "2016-12-01"}, {"date": "2016-12-06"}, {"date": "2016-12-06"}, {"date": "2016-12-08"},
{"date": "2016-12-08"}, {"date": "2016-12-13"}, {"date": "2016-12-13"}, {"date": "2016-12-13"},
{"date": "2016-12-15"}, {"date": "2016-12-15"}, {"date": "2016-12-22"}, {"date": "2016-12-29"},
{"date": "2016-12-29"}
];

describe('start / end date validation', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/util_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('newChartDefinition', () => {
});
});

describe('isToUserDate', () => {
describe('isoToUserDate', () => {
it('converts a datestring to userDateFormat', () => {
expect(isoToUserDate('2018-01-23')).toEqual('01/23/2018');
});
Expand Down

0 comments on commit f8a4cb1

Please sign in to comment.