Force Update - Compare Version

compare version to check should force update or not

4 views

A utility to check whether we should prompt force update or not

ts
type ShouldForceUpdateParams = {
  currentVersion: string; 
  minVersion: string;
}

const shouldForceUpdate = ({ currentVersion, minVersion }: ShouldForceUpdateParams) => {
  return minVersion.localeCompare(
    currentVersion, 
    undefined, 
    { 
      numeric: true, 
      sensitivity: 'case' 
    }
  ) > 0;
}