From aacbb93b213a42b8d46a68c2c54cd3a56dfb4cfb Mon Sep 17 00:00:00 2001
From: Gerhard Schlager <mail@gerhard-schlager.at>
Date: Thu, 28 Mar 2019 14:47:37 +0100
Subject: [PATCH] FIX: moment.js uses a more specific language code for
 Armenian

---
 lib/js_locale_helper.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/js_locale_helper.rb b/lib/js_locale_helper.rb
index 377d11e5508..8628759b1e6 100644
--- a/lib/js_locale_helper.rb
+++ b/lib/js_locale_helper.rb
@@ -162,6 +162,10 @@ module JsLocaleHelper
     result
   end
 
+  MOMENT_LOCALE_MAPPING = {
+    "hy" => "hy-am"
+  }
+
   def self.find_moment_locale(locale_chain, timezone_names: false)
     if timezone_names
       path = "#{Rails.root}/vendor/assets/javascripts/moment-timezone-names-locale"
@@ -172,6 +176,7 @@ module JsLocaleHelper
     end
 
     find_locale(locale_chain, path, type, fallback_to_english: false) do |locale|
+      locale = MOMENT_LOCALE_MAPPING[locale] if MOMENT_LOCALE_MAPPING.key?(locale)
       # moment.js uses a different naming scheme for locale files
       locale.tr('_', '-').downcase
     end