bikram-sambat
Advanced tools
Comparing version 1.6.0 to 1.7.0
{ | ||
"name": "bikram-sambat", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "JS utilities for converting between the Nepali Bikram Sambat (Vikram Samvat) and Gregorian (standard European) calendars.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -51,2 +51,10 @@ var toDevanagari = require('eurodigit/src/to_non_euro').devanagari; | ||
function toDev(year, month, day) { | ||
return { | ||
day: toDevanagari(day), | ||
month: MONTH_NAMES[month-1], | ||
year: toDevanagari(year) | ||
}; | ||
} | ||
function toBik_euro(greg) { | ||
@@ -62,4 +70,5 @@ var d = toBik(greg); | ||
function toBik_text(greg) { | ||
var d = toBik(greg); | ||
return toDevanagari(d.day) + ' ' + MONTH_NAMES[d.month-1] + ' ' + toDevanagari(d.year); | ||
var bik = toBik(greg); | ||
var dev = toDev(bik.year, bik.month, bik.day); | ||
return dev.day + ' ' + dev.month + ' ' + dev.year; | ||
} | ||
@@ -101,2 +110,3 @@ | ||
toBik: toBik, | ||
toDev: toDev, | ||
toBik_dev: toBik_dev, | ||
@@ -103,0 +113,0 @@ toBik_euro: toBik_euro, |
@@ -41,2 +41,23 @@ var _ = require('lodash'), | ||
describe('#toBik()', function() { | ||
_.forIn({ | ||
// gregorian -> bikram | ||
'1950-04-13': { day: 1, month: 1, year: 2007 }, | ||
}, function(expectedBikram, gregorian) { | ||
it('should convert ' + gregorian + ' AD => ' + expectedBikram + ' BS', function() { | ||
// expect | ||
assert.deepEqual(bs.toBik(gregorian), expectedBikram); | ||
}); | ||
}); | ||
}); | ||
describe('#toDev()', function() { | ||
it('should convert 2050-2-1 to ', () => { | ||
assert.deepEqual(bs.toDev(2050, 2, 1), { day: '१', month: 'जेठ', year: '२०५०' }); | ||
}); | ||
}); | ||
describe('#toBik_euro()', function() { | ||
@@ -43,0 +64,0 @@ _.forIn(test_data_for('toBik_euro'), function(expectedBikram, gregorian) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10047
226