Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with incorrect date values #239

Merged
merged 3 commits into from
Nov 29, 2023
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
8 changes: 4 additions & 4 deletions src/components/answer/DateTimeAnswer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const DateTimeAnswer = (props) => {

// workaround because it is not possible to construct Date only with time
let value;
if (isTime && props.value) {
if (isTime && props.value && props.value !== "0") {
value = new Date(`0 ${props.value}`);
} else {
value = props.value ? new Date(props.value) : null;
}
} else if (isDate && props.value && props.value !== "0") {
value = new Date(props.value);
} else value = new Date();

// DatePicker does not know dateFormat "x", translate to datetime
const datePickerFormat =
Expand Down
2 changes: 1 addition & 1 deletion src/components/answer/TypeaheadAnswer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { IntelligentTreeSelect } from "intelligent-tree-select/lib/components/In
import "intelligent-tree-select/lib/styles.css";

const processTypeaheadOptions = (options, intl) => {
if (!options) {
if (!options || !options.length) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed by accident, should be part of #236

return [];
}

Expand Down
Loading