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

Commit

Permalink
Merge pull request #721 from MeasureAuthoringTool/feature/MAT-7774
Browse files Browse the repository at this point in the history
MAT-7774 Updating cqm-models and using QDMDate instead of CQL.Date fo…
  • Loading branch information
RohitKandimalla authored Oct 25, 2024
2 parents 322f11b + 1251556 commit 64605f9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 41 deletions.
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 Timing = ({ canEdit, onChange, selectedDataElement }) => {
const dateFormatToDisplay = (date) => {
if (date) {
const currentDate = dayjs();
const dayjsDate = dayjs(currentDate)
return dayjs(currentDate)
.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 @@ const Timing = ({ canEdit, onChange, selectedDataElement }) => {
) || null
}
onChange={(newValue: any) => {
const newDate = new CQL.Date(
newValue.$y,
newValue.$M + 1,
newValue.$D
);
const newDate = new QDMDate().cast({
year: newValue.$y,
month: newValue.$M + 1,
day: newValue.$D,
});
handleChange(newDate, timingAttr.path);
}}
/>
Expand Down

0 comments on commit 64605f9

Please sign in to comment.