-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: [DHIS2-18081] Problem with date format when scheduling an event #3816
feat: [DHIS2-18081] Problem with date format when scheduling an event #3816
Conversation
src/core_modules/capture-core/utils/converters/date/stringToMomentDateFormat.js
Outdated
Show resolved
Hide resolved
Hey @henrikmv - I like the changes you've made here. However, I think we should keep the |
@@ -45,13 +46,15 @@ export const WidgetEventSchedule = ({ | |||
}); | |||
const { currentUser, noteId } = useNoteDetails(); | |||
const [scheduleDate, setScheduleDate] = useState(''); | |||
const dateFormat = systemSettingsStore.get().dateFormat; | |||
const formatDateForServer = date => moment(date, dateFormat).format('YYYY-MM-DD'); | |||
const formattedScheduleDate = formatDateForServer(scheduleDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @henrikmv
Can you use existing converters instead, in the same way as is currently done elsewhere, i.e. getConvertedRelatedStageEvent?
const convertFn = pipe(convertFormToClient, convertClientToServer);
const serverScheduleDate = convertFn(scheduleDate, dataElementTypes.DATE);
Thanks!
…/fix/DHIS2-18081_DataFormatErrorWhenSchedulingAnEvent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
🚀 Deployed on https://deploy-preview-3816.capture.netlify.dhis2.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested successfully on 2.41.2,2.40.6,2.39.8 versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, Henrik!
# [101.8.0](v101.7.4...v101.8.0) (2024-10-08) ### Features * [DHIS2-18081] Problem with date format when scheduling an event ([#3816](#3816)) ([e12e561](e12e561))
🎉 This PR is included in version 101.8.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
DHIS2-18081
YYYY-MM-DD
.