Skip to content

Commit

Permalink
Staging Patch: Fix setting time on datetime question causing duplicat…
Browse files Browse the repository at this point in the history
…es (#10370)
  • Loading branch information
rithviknishad authored Feb 3, 2025
1 parent 100de0a commit 4ae9cae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import CareIcon from "@/CAREUI/icons/CareIcon";

import { Card } from "@/components/ui/card";

import { formatValue } from "@/components/Facility/ConsultationDetails/QuestionnaireResponsesList";

import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
import { HTTPError } from "@/Utils/request/types";
Expand Down Expand Up @@ -96,7 +98,7 @@ export default function ObservationsList(props: Props) {
)}
{item.value.value && (
<div className="mt-1 font-medium whitespace-pre-wrap">
{item.value.value}
{formatValue(item.value.value, item.value_type)}
</div>
)}
{item.note && (
Expand All @@ -108,7 +110,7 @@ export default function ObservationsList(props: Props) {
{hasNextPage && (
<div ref={ref} className="flex justify-center p-4">
<div className="text-sm text-gray-500">
{isFetchingNextPage ? t("loading_more") : t("load_more")}
{isFetchingNextPage ? t("loading") : t("load_more")}
</div>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ interface QuestionResponseProps {
};
}

function formatValue(value: ResponseValueType["value"], type: string): string {
export function formatValue(
value: ResponseValueType["value"],
type: string,
): string {
if (!value) return "";

// Handle complex objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export function DateTimeQuestion({

updateQuestionnaireResponseCB(
[
...questionnaireResponse.values,
{
type: "dateTime",
value: date.toISOString(),
Expand Down

0 comments on commit 4ae9cae

Please sign in to comment.