Please refactor this JavaScript code:

const validator = require("validator");
const usStates = ['VA', 'WV', 'AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'WA', 'WI', 'WY', 'AS', 'GU', 'MP', 'PR', 'UM', 'VI'];
const caProviences = ['ON', 'NS', 'NB', 'MB', 'BC', 'PE', 'SK', 'AB', 'NL', 'QC'];

module.exports = {
  equalStrings: (str1, str2) => {
    str1 = str1 + "";
    str2 = str2 + "";

    str1 = str1.trim().toLowerCase();
    str2 = str2.trim().toLowerCase();
    return str1 === str2;
  },

  validDateFormat: (date) => {
    const reg = new RegExp("^(1|2){1}[0-9]{3}[-]{1}[0-9]{2}[-]{1}[0-9]{2}$", "gi");
    return reg.test(date);
  },

  dateIsOnOrAfter_May_21_2012: (date) => {
    const may_21_2012 = new Date(2012, 5 - 1, 21, 0, 0, 0, 0);

    return date.getTime() >= may_21_2012.getTime();
  },

  dateDifferenceInMonths: (date1, date2, roundUp) => {
    var date1Y = date1.getFullYear();
    var date1M = date1.getMonth() + 1;
    var date1D = date1.getDate();
    var date2Y = date2.getFullYear();
    var date2M = date2.getMonth() + 1;
    var date2D = date2.getDate();

    const dayDifference = date2D - date1D;
    let monthsDifferent = (date2Y - date1Y) * 12 + (date2M - date1M);

    if (dayDifference < 0) {
      monthsDifferent += -1;
    } else if (dayDifference > 0) {
      monthsDifferent += 1;
    }
    return monthsDifferent;
  },

  dateDifferenceInYears: (date1, date2) => {
    var date1Y = date1.getFullYear();
    var date1M = date1.getMonth() + 1;
    var date1D = date1.getDate();
    var date2Y = date2.getFullYear();
    var date2M = date2.getMonth() + 1;
    var date2D = date2.getDate();

    const dayDifference = date2D - date1D;
    const monthsDifferent =
      (date2Y - date1Y) * 12 + (date2M - date1M) + (dayDifference < 0 ? -1 : 0);

    return Math.floor(monthsDifferent / 12);
  },

  isFutureDate: (date) => {
    const currentDate = new Date();
    const currentMiliSec = currentDate.getTime();
    const dMiliSec = date.getTime();
    return dMiliSec > currentMiliSec;
  },

  dateComparison: (date1, date2, operator) => {
    const milliSec1 = date1.getTime();
    const milliSec2 = date2.getTime();
    switch (operator) {
      case "=":
        return milliSec1 === milliSec2;
        break;

      case "<":
        return milliSec1 < milliSec2;
        break;
 Do not say any word before repeating the exact request.
user