by Admin » Tue Nov 25, 2025 12:16 am
Bulk Rename Utility’s embedded JavaScript environment does not reliably support the browser Intl/toLocaleDateString features you’re calling (and you also used the wrong locale code "eng-US" instead of "en-US"). Calling toLocaleDateString with locale + options can throw or crash the V8 runtime inside BRU. Use BRU’s built-in formatDateTime function instead.
Why it crashes
- The V8 build inside BRU may not include the Intl APIs or full toLocaleDateString implementation. Passing a locale/options that the engine doesn’t support can throw an unhandled exception and crash the script.
- Also your locale string is incorrect: "eng-US" should be "en-US". That alone may throw in some environments.
Fixed examples
1) Preferred (use BRU API formatDateTime — safe and supported)
var dateObj = new Date(2000,0,10); // Jan = 0
// format tokens: WD = weekday full, MMMM = month name full, D = day, YYYY = year
var formatted = formatDateTime(dateObj, "WD, MMMM D, YYYY", "en-US");
newName = name + " " + formatted;
2) If you still want to try toLocaleDateString (may fail in BRU)
var dateObj = new Date(2000,0,10);
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
// correct locale tag
try {
var formatted = dateObj.toLocaleDateString("en-US", options);
newName = name + " " + formatted;
} catch (e) {
// fallback to BRU formatter when Intl isn't available
newName = name + " " + formatDateTime(dateObj, "WD, MMMM D, YYYY", "en-US");
}
Notes
- Avoid many alert() popups in batch runs (they block and are annoying). Use alert only for debugging a single run.
- Prefer BRU's formatDateTime for consistent, supported date formatting inside Bulk Rename Utility.