public int getFiscalYear(DateTime givenDate) { // first find year if ((givenDate == null)) { givenDate = DateTime.Now; } NepaliDate nepaliDate = dateConverter.ToBS(givenDate); int Month = nepaliDate.npMonth; int Day = nepaliDate.npDay; int Year = nepaliDate.npYear; if ((Month >= 4)) { return(Year); } else { return(Year - 1); } }
public void testEnglishToNepaliConverter() { DateTime testDate = new DateTime(1944, 03, 01); while (testDate < new DateTime(2034, 01, 01)) { Assert.AreEqual(dc.ToBS(testDate).getFormattedDate(), original.ToBS(testDate)); testDate = testDate.AddDays(100); } }