Format Numbers in Indian Numbering System

function formatIndianNumber(amount) {

        let formatted ;

        // Parse the number to two decimal places

        if(amount){

         formatted = parseFloat(amount).toLocaleString(‘en-IN’, {

            minimumFractionDigits: 2,

            maximumFractionDigits: 2

        });

    }else{

        formatted = amount

    }

        return formatted; // This will return the formatted string for display purposes

    }

   

Leave a comment

Your email address will not be published. Required fields are marked *