Date Format issue in Mobile View

When the website is in the mobile view when selecting the date the format of the date is yyyy-mm-dd.It is not supported in Netsuite. So the function is used to convert the date to the corresponding format.

 formatDOB: function (dob) {
            var formattedDOB = "";
            var splitDOB = [];

            try {
                if (dob.indexOf('-') !== -1) //Hyphens have been found in the date e.g. yyyy-mm-dd
                {
                    splitDOB = dob.split('-');
                    formattedDOB = splitDOB[2] + "/" + splitDOB[1] + "/" + splitDOB[0];
                } else {
                    formattedDOB = dob;
                }
            } catch (e) {

            }
            return formattedDOB;
        },

Leave a comment

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