diff --git a/README.md b/README.md index a750530..cbfadec 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Formats difference between two dates as a human-readable string in almost any la ### Node.js -In Node.js environment library will load requested locales automatically. +In Node.js environment library will load requested locales automatically from a relative path. ```js const timeDelta = require('time-delta'); @@ -76,7 +76,8 @@ timeDelta.addLocale([enLocale, ruLocale]); // Creating an instance const instance = timeDelta.create({ - locale: 'en', // default + locale: 'en', + autoloadLocales: false }); const date1 = new Date('2015-04-01T21:00:00'); diff --git a/lib/time-delta.js b/lib/time-delta.js index becaf41..05b9b7f 100644 --- a/lib/time-delta.js +++ b/lib/time-delta.js @@ -211,7 +211,9 @@ function requireLocale(localeId) { ); } catch (error) { - throw Error(`Failed to load locale: ${localeId}`); + throw Error( + `Failed to load locale: ${localeId} from ../locales/${localeId}.js. If using a bundled time-delta, set 'autoloadLocales: false' in the config.` + ); } }