Because you can use the new date directly; Convert in a way that does not require formatting.
It is found that using new Date () directly will lead to an increase of one day when some dates are displayed. This is due to the calculation error of the new Date () method itself, so date formatting should be used here instead of the previous method.