ids-enterprise
Version:
Infor Design System (IDS) Enterprise Components for the web
306 lines (295 loc) • 11.8 kB
JavaScript
// Get Latest from http://www.unicode.org/Public/cldr/25/
Soho.Locale.addCulture('ar-SA', {
// layout/language
language: 'ar',
englishName: 'Arabic (Saudi Arabia)',
nativeName: 'العربية (المملكة العربية السعودية)',
// layout/orientation/@characters
direction: 'right-to-left',
calendars: [
{
name: 'islamic-umalqura',
// Note the format here is sort of dd/MM/yyyy
// but this file is ltr and we display this in rtl so its inverted
dateFormat: {
separator: '/', // Infered
timeSeparator: ':',
short: 'yyyy/MM/dd', // use four digit year
medium: 'y MMM، dd',
long: 'yyyy MMMM، dd',
full: 'EEEE، yyyy MMMM، dd',
month: 'dd MMMM',
year: 'MMMM yyyy',
dayOfWeek: 'EEE d',
timestamp: 'h:mm:ss a',
timestampMillis: 'h:mm:ss.SSS a',
hour: 'h:mm a',
datetime: 'yyyy/MM/dd h:mm a',
dateTimestamp: 'yyyy/MM/dd h:mm:ss a',
datetimeMillis: 'yyyy/MM/dd h:mm:ss.SSS a',
timezone: 'yyyy/MM/dd h:mm a zz',
timezoneLong: 'yyyy/MM/dd h:mm a zzzz'
}, // Infered short + short gregorian/dateTimeFormats
days: {
wide: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
abbreviated: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
narrow: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س']
},
months: {
wide: ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'شعبان', 'رمضان', 'شوال', 'ذو القعدة', 'ذو الحجة'],
abbreviated: ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'شعبان', 'رمضان', 'شوال', 'ذو القعدة', 'ذو الحجة']
},
timeFormat: 'h:mm a',
dayPeriods: ['ص', 'م'],
firstDayofWeek: 0, // Starts on Sun
conversions: {
yearInfo: [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
],
minDate: -2198707200000,
maxDate: 1873411199999,
toGregorian: function(hyear, hmonth, hday) { // eslint-disable-line
let days = hday - 1;
const gyear = hyear - 1318;
if (gyear < 0 || gyear >= this.yearInfo.length) {
return null;
}
const info = this.yearInfo[gyear];
const gdate = new Date(info[1]);
let monthLength = info[0];
// Date's ticks in javascript are always from the GMT time,
// but we are interested in the gregorian date in the same timezone,
// not what the gregorian date was at GMT time, so we adjust for the offset.
gdate.setMinutes(gdate.getMinutes() + gdate.getTimezoneOffset());
for (let i = 0; i < hmonth; i++) {
days += 29 + (monthLength & 1);
monthLength >>= 1;
}
gdate.setDate(gdate.getDate() + days);
return gdate;
},
fromGregorian: function(gdate) { // eslint-disable-line
// Date's ticks in javascript are always from the GMT time,
// but we are interested in the hijri date in the same timezone,
// not what the hijri date was at GMT time, so we adjust for the offset.
const ticks = gdate - gdate.getTimezoneOffset() * 60000;
if (ticks < this.minDate || ticks > this.maxDate) {
return null;
}
let hyear = 0;
let hmonth = 1;
// find the earliest gregorian date in the array that is greater than
// or equal to the given date
while (ticks > this.yearInfo[++hyear][1]) { } //eslint-disable-line
if (ticks !== this.yearInfo[hyear][1]) {
hyear--;
}
const info = this.yearInfo[hyear];
// how many days has it been since the date we found in the array?
// 86400000 = ticks per day
let days = Math.floor((ticks - info[1]) / 86400000);
let monthLength = info[0];
hyear += 1318; // the Nth array entry corresponds to hijri year 1318+N
// now increment day/month based on the total days, considering
// how many days are in each month. We cannot run past the year
// mark since we would have found a different array entry in that case.
let daysInMonth = 29 + (monthLength & 1);
while (days >= daysInMonth) {
days -= daysInMonth;
monthLength >>= 1;
daysInMonth = 29 + (monthLength & 1);
hmonth++;
}
// remaining days is less than is in one month, thus is the day of the month we landed on
// hmonth-1 because in javascript months are zero based, stay consistent with that.
return [hyear, hmonth - 1, days + 1,
gdate.getHours(), gdate.getMinutes(), gdate.getSeconds(), gdate.getMilliseconds()];
}
}
},
{
name: 'gregorian',
// Note the format here is sort of dd/MM/yyyy
// but this file is ltr and we display this in rtl so its inverted
// ca-gregorian/main/dates/calendars/gregorian/dateFormats/
dateFormat: {
separator: '/', // Infered
timeSeparator: ':',
short: 'd/MM/yyyy', // use four digit year
medium: 'dd/MM/yyyy',
long: 'd MMMM، yyyy',
full: 'EEEE، d MMMM، yyyy',
month: 'dd MMMM',
year: 'MMMM yyyy',
dayOfWeek: 'EEE d',
timestamp: 'h:mm:ss a',
datetime: 'd/MM/yyyy h:mm a'
}, // Infered short + short gregorian/dateTimeFormats
// ca-gregorian/main/dates/calendars/gregorian/days/format/short or abbreviated (2 digit)
days: {
wide: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
abbreviated: ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
narrow: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س']
},
// ca-gregorian/main/dates/calendars/gregorian/months/format/wide
months: {
wide: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
abbreviated: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر']
},
// ca-gregorian/main/dates/calendars/gregorian/timeFormats/short
timeFormat: 'h:mm a',
// ca-gregorian/main/dates/calendars/gregorian/dayPeriods/wide
dayPeriods: ['ص', 'م'],
firstDayofWeek: 0 // Starts on Sun
}],
// numbers/currencyFormats-numberSystem-latn/standard
currencySign: '﷼',
currencyFormat: '¤ ###',
// numbers/symbols-numberSystem-latn
numbers: {
percentSign: '٪',
percentFormat: '### ٪',
percentSuffix: ' ٪',
percentPrefix: '',
minusSign: '-',
decimal: '٫',
group: '٬',
groupSizes: [3, 3]
},
punctuation: {
comma: '،'
}
});