Skip to content

Commit

Permalink
Remove formatMonthYearDate function and replace it with formatDate
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgain committed Dec 12, 2024
1 parent cb6fbbc commit 547e907
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* put this back into the main transformers file.
*/

const { formatMonthYearDate } = require('../../../utils/date')
const { formatDate, DATE_FORMAT_ISO } = require('../../../utils/date-utils')

const MONTH_DATE_FIELD_LIST = [
'estimated_land_date_before',
Expand All @@ -17,7 +17,7 @@ const transformLandDateFilters = (params) => {
// The API only accepts yyyy-MM-dd format, so month-year filters have to be updated
MONTH_DATE_FIELD_LIST.forEach((field) => {
if (field in params) {
params[field] = formatMonthYearDate(params[field])
params[field] = formatDate(params[field], DATE_FORMAT_ISO)
}
})
return params
Expand Down
4 changes: 0 additions & 4 deletions src/client/utils/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ function format(dateStr, dateFormat = DATE_LONG_FORMAT_2) {
return isDateValid(dateStr) ? formatFns(parseISO(dateStr), dateFormat) : null
}

const formatMonthYearDate = (date) =>
formatFns(parse(date, DATE_SHORT_FORMAT, new Date()), DATE_LONG_FORMAT_3)

const padZero = (value) => {
const parsedValue = parseInt(value, 10)
if (Number.isNaN(parsedValue)) {
Expand Down Expand Up @@ -346,7 +343,6 @@ module.exports = {
addYears,
createAndFormatDateObject,
format,
formatMonthYearDate,
generateFinancialYearLabel,
getDifferenceInDays,
getDifferenceInDaysLabel,
Expand Down

0 comments on commit 547e907

Please sign in to comment.