Utilizing the moment.js library along with the Timezone and BusinessDays extensions in Vue.js, I am developing a datetime format for storing in a MySQL database. Here is the code snippet:
import moment from 'moment-timezone'
import momentBusiness from 'moment-business-days'
momentBusiness.updateLocale('us', {
workingWeekdays: [1, 2, 3, 4, 5]
});
var currentdate = momentBusiness().tz('America/Resolute').format("YYYY-MM-DD HH:mm:SS");
console.log(currentdate); //outputs 2020-07-09 09:07:60
console.log(momentBusiness().tz('America/Resolute').add(4, "hours").format("YYYY-MM-DD HH:mm:SS")); //outputs 2020-07-09 13:07:61
console.log(momentBusiness().tz('America/Resolute').businessAdd(5).format("YYYY-MM-DD HH:mm:SS")); //outputs 2020-07-16 09:07:61
The formatting seems to be functioning correctly according to the displayed results. However, there appears to be an issue with the seconds exceeding 60 mark, causing an exception from MySQL. This problem is quite perplexing, so if anyone has insight into what might be going wrong, please share.