How to format a JavaScript date

For custom-delimited date formats, you have to pull out the date (or time) components from a DateTimeFormat object (which is part of the ECMAScript Internationalization API), and then manually create a string with the delimiters you want. To do this, you can use DateTimeFormat#formatToParts. You could destructure the array, but that is not ideal, as … Read more

How to format a JavaScript date

For custom-delimited date formats, you have to pull out the date (or time) components from a DateTimeFormat object (which is part of the ECMAScript Internationalization API), and then manually create a string with the delimiters you want. To do this, you can use DateTimeFormat#formatToParts. You could destructure the array, but that is not ideal, as the array output depends … Read more

Calculate business days

Here’s a function from the user com ments on the date() function page in the PHP manual. It’s an improvement of an earlier function in the comments that adds support for leap years. Enter the starting and ending dates, along with an array of any holidays that might be in between, and it returns the … Read more