blog
blog Banner

A Recruiter's Playbook: Nailing Date Formats on Global Career Portals

Posted On Monday, July 1, 2024

Author: David Armitage (Technical Director)

Landing top talent from around the globe? You need your date formats in order! Different regions have their own date preferences, and getting them right is crucial for engaging potential hires and ensuring your international recruitment website is a success. Buckle up as we explore how to effortlessly master date formats using JavaScript’s Internationalization API, as laid out by ECMA. Whether it's dates, currencies, or time zones, we’ve got you covered.

Our mission: harnessing the Internationalization API for smooth and efficient date formatting across various languages and regions.

But if you can’t swing that, no worries! You can also use the Accept-Language header from user requests or tap into JavaScript’s navigator.language (Chrome, Firefox) or navigator.browserLanguage (Internet Explorer) properties. Just keep in mind, these might not always hit the mark perfectly for the user’s actual browser language setting.

Verifying Internationalization API Support

Before diving in, check if the browser supports the Internationalization API by looking for the global Intl object. It’s like making sure your recruiter toolkit is complete before starting the search for the perfect candidate.

Exploring the Intl Object

Meet the Intl object, your gateway to the Internationalization API. It offers three main constructor properties: Collator for string comparisons (think sorting candidate names), NumberFormat for number formatting (ideal for salary ranges), and our star of the show, DateTimeFormat, for date and time formatting. We’re zooming in on DateTimeFormat to adapt date and time displays to various languages—making your job postings and interview schedules crystal clear to candidates everywhere.

Capabilities of the DateTimeFormat Object

The DateTimeFormat constructor takes two optional arguments:

  1. locales: A string or an array of strings indicating language tags like “de” for German or “en-GB” for British English. If no specific tag is given, it defaults to the runtime environment’s locale.

  2. options: An object with properties that let you customize the date formatter. Perfect for fine-tuning those date displays on your job listings and application deadlines.

Utilizing the format Function

The DateTimeFormat object’s format function is a gem. It formats a Date object according to the locales and options you’ve set. Just pass it a Date object (or nothing, and it’ll use the current date) to get a nicely formatted date string.

Using the toLocaleDateString Method

For a quick alternative, you can use Date.prototype.toLocaleDateString. This method also takes locales and options arguments. It’s similar to DateTimeFormat but best for applications dealing with fewer dates. Think of it as your quick-access tool for formatting candidate application dates.

Checking Supported Locales

Need to know which locales are supported? Use the supportedLocalesOf method of the DateTimeFormat object. It’ll return an array of all supported locales or an empty array if none are supported. For example, test it with a fictitious locale “blah” to see what’s available.

Final Word

By mastering date formatting, you’ll ensure that your recruitment website speaks the same language as your candidates—literally. It’s one small step for date formats, one giant leap for global recruitment success!


Author: David Armitage (Technical Director)

10 Years+ experience building software, job boards, and websites for the recruitment industry.

Please feel free to contact me for a free consultation, a technical review of your website, or information regarding the services we offer.

You can reach me at david@recsitedesign.com or find me on LinkedIn.