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

[No QA] Remove unused code from DateUtils #41616

Merged
merged 1 commit into from
May 6, 2024
Merged
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
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
Loading