Why Localized Dates and Times Matter in Event Registration
Views (15)
Introduction
Imagine signing up for an exciting virtual event, only to realize later that you completely missed it—because the time was listed in a format you misunderstood. For global audiences, this scenario happens more often than you might think. A simple detail like how dates and times are displayed can make or break the attendee experience.
When your event registration form uses localized date and time formats, you’re not just making a cosmetic change—you’re removing barriers, building trust, and improving attendance. Here’s why it matters.
- Clarity and Accuracy: Date formats vary widely across the globe. For example: 03/04/2025 could mean March 4 in the U.S. or April 3 in Europe. Time zones add another layer of complexity. By localizing dates and times, you eliminate ambiguity and ensure attendees know exactly when your event takes place.
- A Better User Experience: When times and dates appear in a familiar format and local time zone, the registration process feels intuitive. Attendees don’t have to mentally convert time zones or interpret unfamiliar formats—they can focus on what matters: your event.
- Higher Attendance and Engagement: Misinterpreted times often lead to missed sessions. Localized times help participants show up at the right moment, which means better engagement and a more successful event overall.
- Professionalism and Inclusivity: Localization signals that you value your audience’s cultural context. It shows attention to detail and creates a sense of inclusivity, which strengthens your brand’s reputation.
Implementation
On the registration form of real-time events all the date/time values are retrieved through personalization tokens and are rendered inside elements of type .msdynmkt_personalization.
To facilitate the automatic detection and conversion of date/time strings within the event registration form to a localized format, the following scriptis recommended. This implementation utilises the Intl.DateTimeFormat API, enabling configuration of the locale, time zone, and formatting options for accurate date and time representation.
function convertDatesToLocale(
locale = navigator.language /* Use the provided locale, or fall back to the user's browser locale */
) {
const root = document.body;
// Select all elements that might contain date strings
const elements = root.querySelectorAll('.msdynmkt_personalization');
// List of regular expressions to detect various date formats
const dateRegexes = [
// Matches full weekday-style dates like: "Monday, July 7, 2025"
/\b(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday),?\s+
[A-Za-z]+\s+\d{1,2},\s+\d{4}\b/,
// Matches date and time with AM/PM like: "7/7/2025 2:54:00 PM"
/\b\d{1,2}\/\d{1,2}\/\d{4}\s+\d{1,2}:\d{2}:\d{2}\s+[APMapm]{2}\b/,
// Matches just numeric dates like: "7/7/2025"
/\b\d{1,2}\/\d{1,2}\/\d{4}\b/,
];
// Loop over each matched element
elements.forEach((el) => {
const text = el.textContent?.trim(); // Get the element’s text content, trimmed of whitespace
if (!text) return; // Skip if the element is empty or null
// Try each regex on the current text
for (const regex of dateRegexes) {
const match = text.match(regex); // Attempt to match the regex
if (match) {
const dateStr = match[0]; // Extract the matched date string
const parsedDate = parseDate(dateStr); // Attempt to parse it into a Date object
if (parsedDate) {
// Format the parsed date using the desired locale and appropriate format options
const formatted = parsedDate.toLocaleString(locale, {
dateStyle: 'full', // Full date (e.g. "Monday, July 7, 2025")
timeStyle: dateStr.includes(':') ? 'short' : undefined, // Include time if the original string contains it
});
// Replace the original date string in the text with the formatted version
el.textContent = text.replace(dateStr, formatted);
}
break; // Stop after the first matching regex, as each element has just 1 date/time
}
}
});
// Helper function to parse a string into a Date object
function parseDate(dateStr) {
const tryDate = new Date(dateStr); // Attempt using the built-in Date parser
if (!isNaN(tryDate.getTime())) return tryDate; // Return the date if valid
// Future: add custom parsing logic here for unsupported formats
return null; // Return null if parsing failed
}
}
To use this function, simply add it to the “d365mkt-afterformload” event like this:
document.addEventListener("d365mkt-afterformload", function() {
console.log("d365mkt-afterformload");
convertDatesToLocale({/* params */})
});
All parameters are optional, by default, the function automatically adapts to the caller by using the browser’s locale and system timezone. However, you could also add parameters explicitly to a fixed locale:
Parameters
Name | Type | Default | Description |
locale | string | navigator.language | The desired locale which are language + region codes like en-US, de-DE, fr-CA. The full list of available locales is available here. |
timeZone | string | User's browser/system time zone | The IANA time zone to format the date in (e.g., America/New_York). The full list of time zones is available here. |
formatOptions | object | { dateStyle: 'full', timeStyle: 'short' } | Formatting options for date and time from Intl.DateTimeFormat . Examples: { weekday: 'long', year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' } |
Conclusion
In a world where events are increasingly global, small details like localized dates and times have a big impact. They improve clarity, enhance user experience, and help ensure your event runs smoothly. If you want to boost attendance and build trust with your audience, start by speaking their language—literally.
Bottom line: Localization is a valuable enhancement for modern event management, helping make experiences smoother and more inclusive for everyone.
Thanks, Tereza and Armine, for your great work on the blog post content!
*This post is locked for comments