Skip to content

Instantly share code, notes, and snippets.

@adamatan
Created November 22, 2013 15:45
Show Gist options
  • Select an option

  • Save adamatan/7602005 to your computer and use it in GitHub Desktop.

Select an option

Save adamatan/7602005 to your computer and use it in GitHub Desktop.
Hebrew locale file for strftime
var strftime = require('strftime')
var sprintf = require('sprintf')
var he_IL = {
days: [ 'ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת' ],
shortDays: [ 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש' ],
months: [ 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר' ],
shortMonths: [ 'ינו', 'פבר', 'מרץ', 'אפר', 'מאי', 'יונ', 'יול', 'אוג', 'ספט', 'אוק', 'נוב', 'דצמ' ],
AM: 'בבוקר',
PM: 'בערב'
}
function assert_heb_date(format, date, expected_heb_date) {
heb_date=strftime(format, he_IL, date);
console.log(sprintf("%-40s %-40s %s", "\""+heb_date+"\"", "\""+expected_heb_date+"\"", heb_date==expected_heb_date));
}
date = new Date(1385133766);
assert_heb_date('%B %d', date, 'נובמבר 22');
assert_heb_date('%b %d', date, 'נוב 22');
assert_heb_date('%d ב%B', date, '22 בנובמבר');
assert_heb_date('%d'+' '+'ב'+'%B', date, '22 בנובמבר');
assert_heb_date('%l %p', date, ' 5 בערב');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment