Skip to content

Commit

Permalink
Refactored with Date struct and added Weekday Method and Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arjnepwebsites committed Mar 31, 2024
1 parent 964a0be commit 15b3f27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nepalitime/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func Date(year, month, day, hour, min, sec, nsec int) (*NepaliTime, error) {
return nil, err
}

englishTime := time.Date(englishDate[0], time.Month(englishDate[1]), englishDate[2],
englishTime := time.Date(englishDate.Year, time.Month(englishDate.Month), englishDate.Day,
hour, min, sec, nsec, GetNepaliLocation())
return &NepaliTime{year, month, day, &englishTime}, nil
}
Expand All @@ -31,7 +31,7 @@ func FromEnglishTime(englishTime time.Time) (*NepaliTime, error) {
return nil, err
}

return &NepaliTime{englishDate[0], englishDate[1], englishDate[2], &englishTime}, nil
return &NepaliTime{englishDate.Year, englishDate.Month, englishDate.Day, &englishTime}, nil
}

// Now returns the current nepali time.
Expand Down

0 comments on commit 15b3f27

Please sign in to comment.