Skip to content

Commit

Permalink
Merge pull request Expensify#41616 from Expensify/Rory-RemoveUnusedCode
Browse files Browse the repository at this point in the history
[No QA] Remove unused code from DateUtils
  • Loading branch information
techievivek authored May 6, 2024
2 parents bb78140 + 1ed5a39 commit 8383d80
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/libs/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import * as Localize from './Localize';
import Log from './Log';

type CustomStatusTypes = (typeof CONST.CUSTOM_STATUS_TYPES)[keyof typeof CONST.CUSTOM_STATUS_TYPES];
type TimePeriod = 'AM' | 'PM';
type Locale = ValueOf<typeof CONST.LOCALES>;
type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;

Expand Down Expand Up @@ -398,19 +397,6 @@ function addMillisecondsFromDateTime(dateTime: string, milliseconds: number): st
return getDBTime(newTimestamp);
}

/**
* @param isoTimestamp example: 2023-05-16 05:34:14.388
* @returns example: 2023-05-16
*/
function getDateStringFromISOTimestamp(isoTimestamp: string): string {
if (!isoTimestamp) {
return '';
}

const [dateString] = isoTimestamp.split(' ');
return dateString;
}

/**
* returns {string} example: 2023-05-16 05:34:14
*/
Expand Down Expand Up @@ -631,28 +617,6 @@ function get12HourTimeObjectFromDate(dateTime: string): {hour: string; minute: s
};
}

/**
* param {String} timeString
* returns {String}
* example getTimePeriod('11:10 PM') // 'PM'
*/
function getTimePeriod(timeString: string): TimePeriod {
const parts = timeString.split(' ');
return parts[1] as TimePeriod;
}

/**
* param {String} dateTimeStringFirst // YYYY-MM-DD HH:mm:ss
* param {String} dateTimeStringSecond // YYYY-MM-DD HH:mm:ss
* returns {Boolean}
*/
function areDatesIdentical(dateTimeStringFirst: string, dateTimeStringSecond: string): boolean {
const date1 = parse(dateTimeStringFirst, 'yyyy-MM-dd HH:mm:ss', new Date());
const date2 = parse(dateTimeStringSecond, 'yyyy-MM-dd HH:mm:ss', new Date());

return isSameSecond(date1, date2);
}

/**
* Checks if the time input is at least one minute in the future.
* param {String} timeString: '04:24 AM'
Expand Down Expand Up @@ -782,19 +746,13 @@ const DateUtils = {
setLocale,
subtractMillisecondsFromDateTime,
addMillisecondsFromDateTime,
getDateStringFromISOTimestamp,
getThirtyMinutesFromNow,
getEndOfToday,
getOneWeekFromNow,
getDateFromStatusType,
getOneHourFromNow,
extractDate,
formatDateTimeTo12Hour,
getStatusUntilDate,
extractTime12Hour,
get12HourTimeObjectFromDate,
areDatesIdentical,
getTimePeriod,
getLocalizedTimePeriodDescription,
combineDateAndTime,
getDayValidationErrorKey,
Expand All @@ -805,7 +763,6 @@ const DateUtils = {
getMonthNames,
getDaysOfWeek,
formatWithUTCTimeZone,
getWeekStartsOn,
getWeekEndsOn,
isTimeAtLeastOneMinuteInFuture,
formatToSupportedTimezone,
Expand Down

0 comments on commit 8383d80

Please sign in to comment.