chore(deps): update dependency react-datepicker to v8 (#2572)
* fix(deps): update dependency react-datepicker to v8 * chore(deps): update code to work with react-datepicker v8 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Braden MacDonald <braden@opencraft.com>
This commit is contained in:
@@ -265,15 +265,16 @@ export function setupYupExtensions() {
|
||||
});
|
||||
}
|
||||
|
||||
export const convertToDateFromString = (dateStr: string) => {
|
||||
export const convertToDateFromString = (dateStr: string): Date | undefined => {
|
||||
/**
|
||||
* Convert UTC to local time for react-datepicker
|
||||
* Note: react-datepicker has a bug where it only interacts with local time
|
||||
* Note: react-datepicker v4 had a bug where it only interacts with local time
|
||||
* but this bug may no longer be affecting v8+ ?
|
||||
* @param {string} dateStr - YYYY-MM-DDTHH:MM:SSZ
|
||||
* @return {Date} date in local time
|
||||
* @return date in local time
|
||||
*/
|
||||
if (!dateStr) {
|
||||
return '';
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const stripTimeZone = (stringValue: string) => stringValue.substring(0, 19);
|
||||
@@ -281,12 +282,13 @@ export const convertToDateFromString = (dateStr: string) => {
|
||||
return moment(stripTimeZone(String(dateStr))).toDate();
|
||||
};
|
||||
|
||||
export const convertToStringFromDate = (date: moment.MomentInput) => {
|
||||
export const convertToStringFromDate = (date: moment.MomentInput): string => {
|
||||
/**
|
||||
* Convert local time to UTC from react-datepicker
|
||||
* Note: react-datepicker has a bug where it only interacts with local time
|
||||
* Note: react-datepicker v4 had a bug where it only interacts with local time
|
||||
* but this bug may no longer be affecting v8+ ?
|
||||
* @param {Date} date - date in local time
|
||||
* @return {string} YYYY-MM-DDTHH:MM:SSZ
|
||||
* @return YYYY-MM-DDTHH:MM:SSZ
|
||||
*/
|
||||
if (!date) {
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user