How to convert the date into predefined format using utility module

 let currentDate = new Date();
                let previousDate = getDate(-1);
                let nextDate = getDate(1);
                let dates = [
                    JJ_CM_NS_Utility.dateLogic.formatDate(previousDate, 'YYYY-MM-DD'),
                    JJ_CM_NS_Utility.dateLogic.formatDate(currentDate, 'YYYY-MM-DD'),
                    JJ_CM_NS_Utility.dateLogic.formatDate(nextDate, 'YYYY-MM-DD')
                ];

Leave a comment

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