From 30142b40fc274129513eb9611163668fa7ef69cc Mon Sep 17 00:00:00 2001 From: Daniel Varela Date: Tue, 3 Apr 2018 14:27:03 +0200 Subject: [PATCH] Added unix or windows dependent path seperator --- moment-holiday.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/moment-holiday.js b/moment-holiday.js index e84fca6..5d6c085 100644 --- a/moment-holiday.js +++ b/moment-holiday.js @@ -285,10 +285,17 @@ if (!moment.holidays[locale]) { try { - var path = './locale/'; - if (__dirname.split('/').slice(-1).pop() == 'build') { path = '.' + path; } - require(path + locale); - } catch(e) { } + var localePath = './locale/'; + var path = require('path'); + + if (__dirname.split(path.sep).slice(-1).pop() == 'build') { + localePath = '.' + localePath; + } + + require(localePath + locale); + } catch(e) { + throw e; + } } if (moment.holidays[locale]) {