Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

MAT-7774 Updating cqm-models and using QDMDate instead of CQL.Date fo… #721

Merged
merged 5 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 37 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"blueimp-md5": "^2.19.0",
"classnames": "^2.3.1",
"cqm-execution": "4.2.3",
"cqm-models": "^4.1.3",
"cqm-models": "^4.1.5",
"dayjs": "^1.11.7",
"fhir": "^4.11.1",
"file-saver": "^2.0.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useState } from "react";
import { CQL, DataElement } from "cqm-models";
import { QDMDate, CQL, DataElement } from "cqm-models";
import {
DateField,
TimeField,
Button,
} from "@madie/madie-design-system/dist/react";
import dayjs from "dayjs";
import IntegerInput from "../../../../../../../common/IntegerInput/IntegerInput";
import "./DisplayAttributeInputs.scss";
import RatioInput from "../../../../../../../common/ratioInput/RatioInput";
Expand Down Expand Up @@ -57,27 +56,26 @@ const DisplayAttributeInputs = ({
};
const { cqmMeasureState } = useQdmExecutionContext();
const [cqmMeasure] = cqmMeasureState;

const displayAttributeInput = () => {
switch (attributeType) {
case "Date":
return (
<DateField
label="Date"
value={""}
value={attributeValue}
data-testid="date-input"
handleDateChange={(e) => {
const newDate = dayjs.utc(e);
const newCQLDate: CQL.Date = new CQL.Date(
newDate.year(),
newDate.month() + 1,
newDate.date()
);
handleDateChange={(date) => {
const newCQLDate = new QDMDate().cast({
year: date.year(),
month: date.month() + 1,
day: date.date(),
});
setAttributeValue(newCQLDate);
if (onChangeForComponentType) {
onChangeForComponentType(newCQLDate);
}
}}
onBlur={() => {}}
/>
);
case "DateTime":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import DateTimeInput from "../../../../../../../common/dateTimeInput/DateTimeInput";
import DateTimeInterval from "../../../../../../../common/dateTimeInterval/DateTimeInterval";
import { CQL } from "cqm-models";
import { QDMDate } from "cqm-models";
import "./Timing.scss";
import { PRIMARY_TIMING_ATTRIBUTES } from "../../../../../../../../util/QdmAttributeHelpers";
import * as _ from "lodash";
Expand All @@ -24,11 +24,10 @@
const dateFormatToDisplay = (date) => {
if (date) {
const currentDate = dayjs();
const dayjsDate = dayjs(currentDate)
return dayjs(currentDate)

Check warning on line 27 in src/components/editTestCase/qdm/LeftPanel/ElementsTab/Elements/DataElementsCard/timing/Timing.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qdm/LeftPanel/ElementsTab/Elements/DataElementsCard/timing/Timing.tsx#L27

Added line #L27 was not covered by tests
.set("year", date?.year)
.set("month", date?.month)
.set("month", date?.month - 1)
.set("date", date?.day);
return dayjsDate;
}
return;
};
Expand Down Expand Up @@ -82,11 +81,11 @@
) || null
}
onChange={(newValue: any) => {
const newDate = new CQL.Date(
newValue.$y,
newValue.$M + 1,
newValue.$D
);
const newDate = new QDMDate().cast({

Check warning on line 84 in src/components/editTestCase/qdm/LeftPanel/ElementsTab/Elements/DataElementsCard/timing/Timing.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qdm/LeftPanel/ElementsTab/Elements/DataElementsCard/timing/Timing.tsx#L84

Added line #L84 was not covered by tests
year: newValue.$y,
month: newValue.$M + 1,
day: newValue.$D,
});
handleChange(newDate, timingAttr.path);
}}
/>
Expand Down
Loading