englishnepalidateconverter 1.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/bump-version.yml +89 -0
- data/.github/workflows/ci.yml +103 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -0
- data/README.md +213 -44
- data/englishnepalidateconverter.gemspec +7 -7
- data/lib/englishnepalidateconverter/bs_date.rb +4 -57
- data/lib/englishnepalidateconverter/converter.rb +84 -0
- data/lib/englishnepalidateconverter/errors.rb +19 -0
- data/lib/englishnepalidateconverter/extensions/date.rb +2 -11
- data/lib/englishnepalidateconverter/version.rb +1 -1
- data/lib/englishnepalidateconverter.rb +2 -18
- data/spec/englishnepalidateconverter/converter_spec.rb +75 -0
- data/spec/englishnepalidateconverter/version_spec.rb +1 -1
- metadata +25 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9245fe63ba23fc4112152bf3eb0950b314c8427dae211ea38fe1001108d4909c
|
|
4
|
+
data.tar.gz: 6327d4c9ec48085893eb2b91f9c1fe226268398d49a4eb927566f31558680afd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23a1b2025afb02c50987b6f78d05e76b9b87e31bb291cfd9a7fdd25c2a5c65a880c7e78441eb0a40e9ae398ecae10840ebf8f43bc45ccd4f973bd312a0b83adc
|
|
7
|
+
data.tar.gz: 49e2e0b7a6bef9fae4d949f79ca172773becd2fb916ad31d7e9958745c770a11192522b46bb82048c4465ceead5d02cd6e202feeadd80abbe2254e0876331209
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Bump version
|
|
2
|
+
|
|
3
|
+
# Run from GitHub: Actions → "Bump version" → Run workflow, then pick patch, minor or major.
|
|
4
|
+
# It updates lib/englishnepalidateconverter/version.rb, commits it to master, and starts
|
|
5
|
+
# CI on master. CI sees a version with no tag yet, publishes the gem and tags vX.Y.Z.
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
bump:
|
|
10
|
+
description: "Which part of the version to bump"
|
|
11
|
+
required: true
|
|
12
|
+
default: patch
|
|
13
|
+
type: choice
|
|
14
|
+
options:
|
|
15
|
+
- patch
|
|
16
|
+
- minor
|
|
17
|
+
- major
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write # push the version commit
|
|
21
|
+
actions: write # start the CI workflow
|
|
22
|
+
|
|
23
|
+
concurrency:
|
|
24
|
+
group: bump-version
|
|
25
|
+
cancel-in-progress: false
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
bump:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
with:
|
|
33
|
+
ref: master
|
|
34
|
+
|
|
35
|
+
- uses: ruby/setup-ruby@v1
|
|
36
|
+
with:
|
|
37
|
+
ruby-version: .ruby-version
|
|
38
|
+
bundler-cache: true
|
|
39
|
+
|
|
40
|
+
- name: Run tests before bumping
|
|
41
|
+
run: |
|
|
42
|
+
bundle exec rspec
|
|
43
|
+
bundle exec rubocop
|
|
44
|
+
|
|
45
|
+
- name: Bump version.rb
|
|
46
|
+
id: bump
|
|
47
|
+
env:
|
|
48
|
+
BUMP: ${{ inputs.bump }}
|
|
49
|
+
run: |
|
|
50
|
+
file=lib/englishnepalidateconverter/version.rb
|
|
51
|
+
new_version=$(ruby -e '
|
|
52
|
+
file, bump = ARGV
|
|
53
|
+
source = File.read(file)
|
|
54
|
+
match = source.match(/VERSION = "(\d+)\.(\d+)\.(\d+)"/) or abort("No VERSION found in #{file}")
|
|
55
|
+
major, minor, patch = match.captures.map(&:to_i)
|
|
56
|
+
case bump
|
|
57
|
+
when "major" then major += 1; minor = 0; patch = 0
|
|
58
|
+
when "minor" then minor += 1; patch = 0
|
|
59
|
+
when "patch" then patch += 1
|
|
60
|
+
else abort("Unknown bump: #{bump}")
|
|
61
|
+
end
|
|
62
|
+
version = "#{major}.#{minor}.#{patch}"
|
|
63
|
+
File.write(file, source.sub(match[0], %(VERSION = "#{version}")))
|
|
64
|
+
puts version
|
|
65
|
+
' "$file" "$BUMP")
|
|
66
|
+
if git rev-parse -q --verify "refs/tags/v$new_version" >/dev/null || \
|
|
67
|
+
git ls-remote --exit-code --tags origin "refs/tags/v$new_version" >/dev/null; then
|
|
68
|
+
echo "Tag v$new_version already exists"
|
|
69
|
+
exit 1
|
|
70
|
+
fi
|
|
71
|
+
echo "version=$new_version" >> "$GITHUB_OUTPUT"
|
|
72
|
+
git diff
|
|
73
|
+
|
|
74
|
+
- name: Commit and push
|
|
75
|
+
env:
|
|
76
|
+
VERSION: ${{ steps.bump.outputs.version }}
|
|
77
|
+
run: |
|
|
78
|
+
git config user.name "github-actions[bot]"
|
|
79
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
80
|
+
git add lib/englishnepalidateconverter/version.rb
|
|
81
|
+
git commit -m "Bump version to $VERSION"
|
|
82
|
+
git push origin master
|
|
83
|
+
|
|
84
|
+
# A push made with GITHUB_TOKEN does not trigger other workflows,
|
|
85
|
+
# so start CI on master explicitly; its release job publishes and tags.
|
|
86
|
+
- name: Start release
|
|
87
|
+
env:
|
|
88
|
+
GH_TOKEN: ${{ github.token }}
|
|
89
|
+
run: gh workflow run ci.yml --ref master
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
# Run manually from the Actions tab to retry a release, e.g. if one of the
|
|
8
|
+
# two gems failed to publish. Gems already on RubyGems.org are skipped.
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: ruby/setup-ruby@v1
|
|
20
|
+
with:
|
|
21
|
+
ruby-version: .ruby-version
|
|
22
|
+
bundler-cache: true
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: bundle exec rspec
|
|
25
|
+
- name: Run linter
|
|
26
|
+
run: bundle exec rubocop
|
|
27
|
+
|
|
28
|
+
# Releases automatically when a commit on master has a version that has no
|
|
29
|
+
# git tag yet: builds the gem under both names, pushes both to RubyGems.org,
|
|
30
|
+
# then creates and pushes the vX.Y.Z tag. To release, just bump VERSION.
|
|
31
|
+
release:
|
|
32
|
+
needs: test
|
|
33
|
+
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
permissions:
|
|
36
|
+
contents: write # needed to push the version tag
|
|
37
|
+
id-token: write # needed for RubyGems.org trusted publishing
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- uses: ruby/setup-ruby@v1
|
|
41
|
+
with:
|
|
42
|
+
ruby-version: .ruby-version
|
|
43
|
+
|
|
44
|
+
- name: Read version and check for existing tag
|
|
45
|
+
id: version
|
|
46
|
+
run: |
|
|
47
|
+
version=$(ruby -Ilib -e 'require "englishnepalidateconverter/version"; puts EnglishNepaliDateConverter::VERSION')
|
|
48
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
49
|
+
if git ls-remote --exit-code --tags origin "refs/tags/v$version" > /dev/null; then
|
|
50
|
+
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
|
|
51
|
+
echo "Tag v$version already exists"
|
|
52
|
+
else
|
|
53
|
+
echo "tag_exists=false" >> "$GITHUB_OUTPUT"
|
|
54
|
+
echo "Tag v$version does not exist yet, releasing"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
- name: Decide whether to release
|
|
58
|
+
id: release
|
|
59
|
+
run: |
|
|
60
|
+
if [ "${{ steps.version.outputs.tag_exists }}" = "false" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
61
|
+
echo "publish=true" >> "$GITHUB_OUTPUT"
|
|
62
|
+
else
|
|
63
|
+
echo "publish=false" >> "$GITHUB_OUTPUT"
|
|
64
|
+
echo "Version unchanged, nothing to release"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
- name: Build gems
|
|
68
|
+
if: steps.release.outputs.publish == 'true'
|
|
69
|
+
run: |
|
|
70
|
+
ruby -rrubygems/package -e '
|
|
71
|
+
spec = Gem::Specification.load("englishnepalidateconverter.gemspec")
|
|
72
|
+
%w[englishnepalidateconverter english_nepali_date_converter].each do |name|
|
|
73
|
+
copy = spec.dup
|
|
74
|
+
copy.name = name
|
|
75
|
+
Gem::Package.build(copy)
|
|
76
|
+
end
|
|
77
|
+
'
|
|
78
|
+
ls -l *.gem
|
|
79
|
+
|
|
80
|
+
- name: Configure RubyGems credentials
|
|
81
|
+
if: steps.release.outputs.publish == 'true'
|
|
82
|
+
uses: rubygems/configure-rubygems-credentials@v2.2.0
|
|
83
|
+
|
|
84
|
+
- name: Push gems to RubyGems.org
|
|
85
|
+
if: steps.release.outputs.publish == 'true'
|
|
86
|
+
run: |
|
|
87
|
+
for gem in *.gem; do
|
|
88
|
+
if output=$(gem push "$gem" 2>&1); then
|
|
89
|
+
echo "$output"
|
|
90
|
+
elif echo "$output" | grep -q "Repushing of gem versions is not allowed"; then
|
|
91
|
+
echo "$gem is already on RubyGems.org, skipping"
|
|
92
|
+
else
|
|
93
|
+
echo "$output"
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
done
|
|
97
|
+
|
|
98
|
+
- name: Create and push version tag
|
|
99
|
+
if: steps.release.outputs.publish == 'true' && steps.version.outputs.tag_exists == 'false'
|
|
100
|
+
run: |
|
|
101
|
+
tag="v${{ steps.version.outputs.version }}"
|
|
102
|
+
git tag "$tag"
|
|
103
|
+
git push origin "$tag"
|
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.10
|
data/README.md
CHANGED
|
@@ -1,89 +1,258 @@
|
|
|
1
1
|
# EnglishNepaliDateConverter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/dlamichhane/englishnepalidateconverter/actions/workflows/ci.yml)
|
|
4
|
+
[](https://rubygems.org/gems/englishnepalidateconverter)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A dependency-free Ruby gem that converts dates between the Gregorian calendar (AD) and the Bikram Sambat calendar (BS), Nepal's official calendar. It can also format BS dates in Nepali script, with month and weekday names in Nepali, romanized Nepali or English.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
```ruby
|
|
9
|
+
require "englishnepalidateconverter"
|
|
10
|
+
|
|
11
|
+
Converter = EnglishNepaliDateConverter::Converter
|
|
12
|
+
|
|
13
|
+
Converter.to_bs(Date.new(2014, 1, 17)).to_nepali # => "माघ ३, २०७०"
|
|
14
|
+
Converter.to_ad(2070, 10, 3) # => #<Date: 2014-01-17>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Contents
|
|
18
|
+
|
|
19
|
+
- [Features](#features)
|
|
20
|
+
- [Supported date range](#supported-date-range)
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [Usage](#usage)
|
|
23
|
+
- [The converter](#the-converter)
|
|
24
|
+
- [Convert BS to AD](#convert-bs-to-ad)
|
|
25
|
+
- [Convert AD to BS](#convert-ad-to-bs)
|
|
26
|
+
- [Today's date in BS](#todays-date-in-bs)
|
|
27
|
+
- [Month and weekday names](#month-and-weekday-names)
|
|
28
|
+
- [Nepali digits](#nepali-digits)
|
|
29
|
+
- [Error handling](#error-handling)
|
|
30
|
+
- [API reference](#api-reference)
|
|
31
|
+
- [Development](#development)
|
|
32
|
+
- [Contributing](#contributing)
|
|
33
|
+
- [License](#license)
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- Convert BS to AD and AD to BS.
|
|
38
|
+
- Get today's date in BS.
|
|
39
|
+
- Month names in Nepali (`माघ`) or romanized Nepali (`Magh`).
|
|
40
|
+
- Weekday names in Nepali (`शुक्रबार`), romanized Nepali (`Shukrabar`) or English (`Friday`).
|
|
41
|
+
- Full Nepali date strings such as `माघ ३, २०७०`.
|
|
42
|
+
- Convert any integer to Nepali digits (`2070` → `२०७०`).
|
|
43
|
+
- No runtime dependencies. It uses only Ruby's standard `Date` library.
|
|
44
|
+
|
|
45
|
+
## Supported date range
|
|
46
|
+
|
|
47
|
+
Conversion uses a built-in table of BS month lengths, so it only works within this range:
|
|
48
|
+
|
|
49
|
+
| Direction | From | To |
|
|
50
|
+
| --------- | ---------- | ---------- |
|
|
51
|
+
| AD → BS | 1943-04-14 | 2034-04-13 |
|
|
52
|
+
| BS → AD | 2000-01-01 | 2090-12-30 |
|
|
53
|
+
|
|
54
|
+
Dates outside this range raise an error. See [Error handling](#error-handling).
|
|
9
55
|
|
|
10
56
|
## Installation
|
|
11
57
|
|
|
12
|
-
|
|
58
|
+
Requires Ruby 4.0 or newer. Version 1.0.0 on RubyGems still supports Ruby 3.4.
|
|
13
59
|
|
|
14
|
-
|
|
60
|
+
Add the gem to your application's `Gemfile`:
|
|
15
61
|
|
|
16
|
-
|
|
62
|
+
```ruby
|
|
63
|
+
gem "englishnepalidateconverter"
|
|
64
|
+
```
|
|
17
65
|
|
|
18
|
-
|
|
66
|
+
Then run:
|
|
19
67
|
|
|
20
|
-
|
|
68
|
+
```sh
|
|
69
|
+
bundle install
|
|
70
|
+
```
|
|
21
71
|
|
|
22
|
-
|
|
72
|
+
Or install it directly:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
gem install englishnepalidateconverter
|
|
76
|
+
```
|
|
23
77
|
|
|
24
78
|
## Usage
|
|
25
79
|
|
|
26
|
-
|
|
80
|
+
Require the gem once. It loads `date` for you:
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
require "englishnepalidateconverter"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### The converter
|
|
87
|
+
|
|
88
|
+
`EnglishNepaliDateConverter::Converter` handles both directions in one place:
|
|
27
89
|
|
|
28
90
|
```ruby
|
|
29
|
-
|
|
91
|
+
Converter = EnglishNepaliDateConverter::Converter
|
|
30
92
|
|
|
31
|
-
|
|
93
|
+
Converter.to_bs(Date.new(2025, 9, 3)) # => BSDate 2082-05-18
|
|
94
|
+
Converter.to_ad(BSDate.new(2082, 5, 18)) # => #<Date: 2025-09-03>
|
|
95
|
+
Converter.to_ad(2082, 5, 18) # => #<Date: 2025-09-03>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Both methods check that the date is within the [supported range](#supported-date-range). `Date#to_bs`, `BSDate#to_ad` and `BSDate.from_ad`, described below, are shortcuts that call the converter.
|
|
99
|
+
|
|
100
|
+
### Convert BS to AD
|
|
101
|
+
|
|
102
|
+
Create a `BSDate` from a year, month and day, then call `to_ad`. It returns a standard Ruby `Date`:
|
|
103
|
+
|
|
104
|
+
```ruby
|
|
32
105
|
bs_date = BSDate.new(2070, 10, 3)
|
|
33
|
-
puts bs_date.to_ad # => 2014-01-16
|
|
34
106
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
107
|
+
ad_date = bs_date.to_ad # => #<Date: 2014-01-17>
|
|
108
|
+
ad_date.to_s # => "2014-01-17"
|
|
109
|
+
ad_date.strftime("%d %B %Y") # => "17 January 2014"
|
|
110
|
+
```
|
|
38
111
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
112
|
+
Months are numbered 1 to 12, with 1 being Baisakh. See the [month table](#months).
|
|
113
|
+
|
|
114
|
+
### Convert AD to BS
|
|
115
|
+
|
|
116
|
+
Call `to_bs` on any `Date`:
|
|
117
|
+
|
|
118
|
+
```ruby
|
|
119
|
+
bs_date = Date.new(2014, 1, 17).to_bs
|
|
120
|
+
|
|
121
|
+
bs_date.year # => 2070
|
|
122
|
+
bs_date.month # => 10
|
|
123
|
+
bs_date.day # => 3
|
|
42
124
|
```
|
|
43
125
|
|
|
44
|
-
|
|
126
|
+
`BSDate.from_ad(date)` does the same conversion.
|
|
127
|
+
|
|
128
|
+
### Today's date in BS
|
|
129
|
+
|
|
130
|
+
Call `BSDate.new` with no arguments to get today's date in BS:
|
|
45
131
|
|
|
46
132
|
```ruby
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
bs_date = ad_date.to_bs
|
|
50
|
-
puts "#{bs_date.year}-#{bs_date.month}-#{bs_date.day}" # => 2070-10-3
|
|
133
|
+
today = BSDate.new
|
|
134
|
+
today.to_nepali # => e.g. "मंसिर २१, २०८३"
|
|
51
135
|
```
|
|
52
136
|
|
|
53
|
-
###
|
|
137
|
+
### Month and weekday names
|
|
54
138
|
|
|
55
139
|
```ruby
|
|
56
140
|
bs_date = BSDate.new(2070, 10, 3)
|
|
57
141
|
|
|
58
|
-
#
|
|
59
|
-
|
|
142
|
+
bs_date.month_name # => "माघ"
|
|
143
|
+
bs_date.month_name(romanized: true) # => "Magh"
|
|
60
144
|
|
|
61
|
-
#
|
|
62
|
-
|
|
145
|
+
bs_date.day_name # => "शुक्रबार"
|
|
146
|
+
bs_date.day_name(romanized: true) # => "Shukrabar"
|
|
147
|
+
bs_date.day_name(localized: true) # => "Friday"
|
|
63
148
|
|
|
64
|
-
#
|
|
65
|
-
|
|
149
|
+
bs_date.to_nepali # => "माघ ३, २०७०"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`day_name` takes either `romanized: true` or `localized: true`, not both at once.
|
|
153
|
+
|
|
154
|
+
#### Months
|
|
155
|
+
|
|
156
|
+
| # | Nepali | Romanized |
|
|
157
|
+
| --- | ------- | --------- |
|
|
158
|
+
| 1 | बैशाख | Baisakh |
|
|
159
|
+
| 2 | जेठ | Jeth |
|
|
160
|
+
| 3 | असार | Asar |
|
|
161
|
+
| 4 | श्रावण | Shrawan |
|
|
162
|
+
| 5 | भाद्र | Bhadra |
|
|
163
|
+
| 6 | आश्विन | Ashwin |
|
|
164
|
+
| 7 | कार्तिक | Kartik |
|
|
165
|
+
| 8 | मंसिर | Mangsir |
|
|
166
|
+
| 9 | पुष | Poush |
|
|
167
|
+
| 10 | माघ | Magh |
|
|
168
|
+
| 11 | फाल्गुण | Falgun |
|
|
169
|
+
| 12 | चैत | Chaitra |
|
|
66
170
|
|
|
67
|
-
|
|
68
|
-
puts bs_date.day_name(romanized: true) # => "Budhbar"
|
|
171
|
+
#### Weekdays
|
|
69
172
|
|
|
70
|
-
|
|
71
|
-
|
|
173
|
+
| English | Nepali | Romanized |
|
|
174
|
+
| --------- | -------- | --------- |
|
|
175
|
+
| Sunday | आइतबार | Aaitabar |
|
|
176
|
+
| Monday | सोमबार | Sombar |
|
|
177
|
+
| Tuesday | मंगलवार | Mangalbar |
|
|
178
|
+
| Wednesday | बुधबार | Budhbar |
|
|
179
|
+
| Thursday | बिहीबार | Bihibar |
|
|
180
|
+
| Friday | शुक्रबार | Shukrabar |
|
|
181
|
+
| Saturday | शनिवार | Shanibar |
|
|
72
182
|
|
|
73
|
-
|
|
74
|
-
|
|
183
|
+
### Nepali digits
|
|
184
|
+
|
|
185
|
+
The gem adds `to_nepali` to `Integer`, which returns the number written in Nepali digits:
|
|
186
|
+
|
|
187
|
+
```ruby
|
|
188
|
+
2070.to_nepali # => "२०७०"
|
|
189
|
+
16.to_nepali # => "१६"
|
|
190
|
+
-5.to_nepali # => "-५"
|
|
75
191
|
```
|
|
76
192
|
|
|
77
|
-
###
|
|
193
|
+
### Error handling
|
|
194
|
+
|
|
195
|
+
All of the gem's errors inherit from `EnglishNepaliDateConverter::Error`, so you can catch them all with one `rescue`:
|
|
196
|
+
|
|
197
|
+
| Error | Raised when |
|
|
198
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
199
|
+
| `DateOutOfRangeError` | `Converter.to_bs` (or `Date#to_bs`, `BSDate.from_ad`) gets a date outside 1943-04-14 to 2034-04-13. |
|
|
200
|
+
| `BSDateOutOfRangeError` | `Converter.to_ad` or `BSDate#to_ad` (and methods that use it, such as `day_name`) gets a year outside 2000 to 2090, a month outside 1 to 12, or a day that doesn't exist in that BS month. |
|
|
78
201
|
|
|
79
202
|
```ruby
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
203
|
+
begin
|
|
204
|
+
Date.new(1900, 1, 1).to_bs
|
|
205
|
+
rescue EnglishNepaliDateConverter::Error => e
|
|
206
|
+
puts e.message
|
|
207
|
+
# => "Date 1900-01-01 is out of supported AD Range (1943-04-14 - 2034-04-13)"
|
|
208
|
+
end
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`BSDate.new` doesn't check its arguments when you create it. An invalid date raises an error only when you convert it or ask for its weekday.
|
|
212
|
+
|
|
213
|
+
## API reference
|
|
214
|
+
|
|
215
|
+
`Converter` lives only inside `EnglishNepaliDateConverter`. `BSDate`, `DateOutOfRangeError` and `BSDateOutOfRangeError` are available at the top level, and also inside `EnglishNepaliDateConverter`.
|
|
216
|
+
|
|
217
|
+
| Method | Returns | Description |
|
|
218
|
+
| ----------------------------------------------------------------- | --------- | ---------------------------------------------------- |
|
|
219
|
+
| `Converter.to_bs(date)` | `BSDate` | Converts a `Date` to BS, with a range check. |
|
|
220
|
+
| `Converter.to_ad(bs_date)` or `Converter.to_ad(year, month, day)` | `Date` | Converts a BS date to AD, with a range check. |
|
|
221
|
+
| `BSDate.new(year, month, day)` | `BSDate` | A BS date. Not validated until it is used. |
|
|
222
|
+
| `BSDate.new` | `BSDate` | Today's date in BS. |
|
|
223
|
+
| `BSDate.from_ad(date)` | `BSDate` | Same as `Converter.to_bs`. |
|
|
224
|
+
| `BSDate#year`, `#month`, `#day` | `Integer` | Parts of the BS date. |
|
|
225
|
+
| `BSDate#to_ad` | `Date` | Converts to AD. |
|
|
226
|
+
| `BSDate#month_name(romanized: false)` | `String` | Month name in Nepali, or romanized Nepali. |
|
|
227
|
+
| `BSDate#day_name(romanized: nil, localized: nil)` | `String` | Weekday name in Nepali, romanized Nepali or English. |
|
|
228
|
+
| `BSDate#to_nepali` | `String` | Formatted date, e.g. `"माघ ३, २०७०"`. |
|
|
229
|
+
| `Date#to_bs` | `BSDate` | Same as `Converter.to_bs`. |
|
|
230
|
+
| `Integer#to_nepali` | `String` | The number in Nepali digits. |
|
|
231
|
+
|
|
232
|
+
## Development
|
|
233
|
+
|
|
234
|
+
After cloning the repository:
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
bundle install # install development dependencies
|
|
238
|
+
bundle exec rspec # run the tests
|
|
239
|
+
bundle exec rubocop # run the linter
|
|
240
|
+
bundle exec rake install # build and install the gem locally
|
|
83
241
|
```
|
|
84
242
|
|
|
243
|
+
The BS month-length table is in [`lib/englishnepalidateconverter/bs_calendar.rb`](lib/englishnepalidateconverter/bs_calendar.rb). To support more years, add rows there. The supported AD and BS ranges are derived from the table, and all conversion logic lives in [`lib/englishnepalidateconverter/converter.rb`](lib/englishnepalidateconverter/converter.rb).
|
|
244
|
+
|
|
245
|
+
## Contributing
|
|
246
|
+
|
|
247
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/dlamichhane/englishnepalidateconverter).
|
|
248
|
+
|
|
249
|
+
1. Fork the repository and create a branch for your change.
|
|
250
|
+
2. Add tests for it in `spec/`.
|
|
251
|
+
3. Make sure `bundle exec rspec` and `bundle exec rubocop` pass.
|
|
252
|
+
4. Open a pull request.
|
|
253
|
+
|
|
85
254
|
## License
|
|
86
255
|
|
|
87
|
-
This
|
|
256
|
+
This gem is available under the [MIT License](LICENSE.txt).
|
|
88
257
|
|
|
89
|
-
Copyright (c)
|
|
258
|
+
Copyright (c) 2027 dlamichhane
|
|
@@ -8,7 +8,7 @@ require "englishnepalidateconverter/version"
|
|
|
8
8
|
Gem::Specification.new do |spec|
|
|
9
9
|
spec.name = "englishnepalidateconverter"
|
|
10
10
|
spec.version = EnglishNepaliDateConverter::VERSION
|
|
11
|
-
spec.date = %(
|
|
11
|
+
spec.date = %(2026-12-06)
|
|
12
12
|
spec.authors = ["dlamichhane"]
|
|
13
13
|
spec.email = ["lamichhanedeepak@gmail.com"]
|
|
14
14
|
spec.description = "Conversion of Gregorian calendar to Nepali Calendar"
|
|
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
22
22
|
spec.require_paths = ["lib"]
|
|
23
23
|
|
|
24
|
-
spec.add_development_dependency "bundler", "~>
|
|
24
|
+
spec.add_development_dependency "bundler", "~> 4.0"
|
|
25
25
|
spec.add_development_dependency "pry-byebug"
|
|
26
26
|
spec.add_development_dependency "rake"
|
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.
|
|
28
|
-
spec.add_development_dependency "rubocop", "~> 1.
|
|
29
|
-
spec.add_development_dependency "rubocop-rake"
|
|
30
|
-
spec.add_development_dependency "rubocop-rspec"
|
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
|
28
|
+
spec.add_development_dependency "rubocop", "~> 1.93"
|
|
29
|
+
spec.add_development_dependency "rubocop-rake", "~> 0.7"
|
|
30
|
+
spec.add_development_dependency "rubocop-rspec", "~> 3.11"
|
|
31
31
|
|
|
32
|
-
spec.required_ruby_version = ">=
|
|
32
|
+
spec.required_ruby_version = ">= 4.0"
|
|
33
33
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "bs_calendar"
|
|
4
|
+
require_relative "converter"
|
|
4
5
|
|
|
5
6
|
module EnglishNepaliDateConverter
|
|
6
7
|
# Base BS Date class
|
|
@@ -16,7 +17,7 @@ module EnglishNepaliDateConverter
|
|
|
16
17
|
@day = day
|
|
17
18
|
else
|
|
18
19
|
# No arguments provided, use current AD date and convert to BS
|
|
19
|
-
bs =
|
|
20
|
+
bs = Converter.to_bs(Date.today)
|
|
20
21
|
@year = bs.year
|
|
21
22
|
@month = bs.month
|
|
22
23
|
@day = bs.day
|
|
@@ -29,14 +30,12 @@ module EnglishNepaliDateConverter
|
|
|
29
30
|
|
|
30
31
|
# Convert Bikram Sambat date to Anno Domini (Gregorian) date
|
|
31
32
|
def to_ad
|
|
32
|
-
|
|
33
|
-
Date.jd(bs_to_jd(@year, @month, @day))
|
|
33
|
+
Converter.to_ad(self)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Convert Anno Domini (Gregorian) date to Bikram Sambat date
|
|
37
37
|
def self.from_ad(ad_date)
|
|
38
|
-
|
|
39
|
-
new(year, month, day)
|
|
38
|
+
Converter.to_bs(ad_date)
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
def month_name(romanized: false)
|
|
@@ -55,57 +54,5 @@ module EnglishNepaliDateConverter
|
|
|
55
54
|
|
|
56
55
|
WEEKDAYS.keys[ad_date.wday]
|
|
57
56
|
end
|
|
58
|
-
|
|
59
|
-
private
|
|
60
|
-
|
|
61
|
-
def validate_date!
|
|
62
|
-
return if valid_date?
|
|
63
|
-
|
|
64
|
-
raise BSDateOutOfRangeError,
|
|
65
|
-
"Year #{year} is out of valid range (#{MONTH_DAYS.keys.first}-#{MONTH_DAYS.keys.last})"
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def valid_date?
|
|
69
|
-
MONTH_DAYS.key?(year) && (1..12).include?(month) && (1..MONTH_DAYS[year][month - 1]).include?(day)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def bs_to_jd(year, month, day)
|
|
73
|
-
julian_day = EPOCH_JD
|
|
74
|
-
|
|
75
|
-
# Add days from complete years
|
|
76
|
-
(EPOCH_BS[0]...year).each do |year_index|
|
|
77
|
-
julian_day += MONTH_DAYS[year_index].sum
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Add days from complete months in the current year
|
|
81
|
-
julian_day += MONTH_DAYS[year][0...(month - 1)].sum
|
|
82
|
-
|
|
83
|
-
# Add remaining days
|
|
84
|
-
julian_day += (day - 1)
|
|
85
|
-
|
|
86
|
-
julian_day
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def self.jd_to_bs(julian_day)
|
|
90
|
-
year = EPOCH_BS[0]
|
|
91
|
-
remaining_days = julian_day - EPOCH_JD
|
|
92
|
-
|
|
93
|
-
# Find the correct year by subtracting complete years
|
|
94
|
-
while remaining_days >= MONTH_DAYS[year].sum
|
|
95
|
-
remaining_days -= MONTH_DAYS[year].sum
|
|
96
|
-
year += 1
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# Find the correct month and day within the year
|
|
100
|
-
month = 1
|
|
101
|
-
MONTH_DAYS[year].each do |days_in_month|
|
|
102
|
-
break if remaining_days < days_in_month
|
|
103
|
-
|
|
104
|
-
remaining_days -= days_in_month
|
|
105
|
-
month += 1
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
[year, month, remaining_days + 1]
|
|
109
|
-
end
|
|
110
57
|
end
|
|
111
58
|
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
4
|
+
require_relative "bs_calendar"
|
|
5
|
+
require_relative "bs_date"
|
|
6
|
+
require_relative "errors"
|
|
7
|
+
|
|
8
|
+
module EnglishNepaliDateConverter
|
|
9
|
+
# Converts dates between the Gregorian (AD) and Bikram Sambat (BS) calendars.
|
|
10
|
+
class Converter
|
|
11
|
+
include BSCalendar
|
|
12
|
+
|
|
13
|
+
AD_RANGE = (EPOCH_AD..(EPOCH_AD + MONTH_DAYS.values.sum(&:sum) - 1))
|
|
14
|
+
BS_RANGE = (EPOCH_BS..[MONTH_DAYS.keys.last, 12, MONTH_DAYS.values.last.last])
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
# Convert an AD date (Date, DateTime or Time) to a BSDate.
|
|
18
|
+
# Raises DateOutOfRangeError outside the supported range.
|
|
19
|
+
def to_bs(ad_date)
|
|
20
|
+
ad_date = ad_date.to_date
|
|
21
|
+
unless AD_RANGE.cover?(ad_date)
|
|
22
|
+
raise DateOutOfRangeError,
|
|
23
|
+
"Date #{ad_date} is out of supported AD Range (#{AD_RANGE.begin} - #{AD_RANGE.end})"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
year, month, day = jd_to_bs(ad_date.jd)
|
|
27
|
+
BSDate.new(year, month, day)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Convert a BS date to an AD Date. Accepts a BSDate or year, month, day.
|
|
31
|
+
# Raises BSDateOutOfRangeError if the BS date does not exist in the table.
|
|
32
|
+
def to_ad(*args)
|
|
33
|
+
year, month, day = bs_parts(*args)
|
|
34
|
+
validate_bs!(year, month, day)
|
|
35
|
+
Date.jd(bs_to_jd(year, month, day))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def bs_parts(*args)
|
|
41
|
+
case args
|
|
42
|
+
in [BSDate => bs_date] then [bs_date.year, bs_date.month, bs_date.day]
|
|
43
|
+
in [Integer, Integer, Integer] then args
|
|
44
|
+
else raise ArgumentError, "Expected a BSDate or year, month, day integers"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def validate_bs!(year, month, day)
|
|
49
|
+
return if MONTH_DAYS.key?(year) && (1..12).cover?(month) && (1..MONTH_DAYS[year][month - 1]).cover?(day)
|
|
50
|
+
|
|
51
|
+
raise BSDateOutOfRangeError,
|
|
52
|
+
"BS date #{year}-#{month}-#{day} is out of supported range " \
|
|
53
|
+
"(#{BS_RANGE.begin.join("-")} - #{BS_RANGE.end.join("-")})"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def bs_to_jd(year, month, day)
|
|
57
|
+
days_in_prior_years = (EPOCH_BS[0]...year).sum { |y| MONTH_DAYS[y].sum }
|
|
58
|
+
days_in_prior_months = MONTH_DAYS[year].first(month - 1).sum
|
|
59
|
+
|
|
60
|
+
EPOCH_JD + days_in_prior_years + days_in_prior_months + (day - 1)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def jd_to_bs(julian_day)
|
|
64
|
+
year = EPOCH_BS[0]
|
|
65
|
+
remaining_days = julian_day - EPOCH_JD
|
|
66
|
+
|
|
67
|
+
while remaining_days >= MONTH_DAYS[year].sum
|
|
68
|
+
remaining_days -= MONTH_DAYS[year].sum
|
|
69
|
+
year += 1
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
month = 1
|
|
73
|
+
MONTH_DAYS[year].each do |days_in_month|
|
|
74
|
+
break if remaining_days < days_in_month
|
|
75
|
+
|
|
76
|
+
remaining_days -= days_in_month
|
|
77
|
+
month += 1
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
[year, month, remaining_days + 1]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module EnglishNepaliDateConverter
|
|
4
|
+
class Error < StandardError; end
|
|
5
|
+
|
|
6
|
+
# Date out of range error
|
|
7
|
+
class DateOutOfRangeError < Error
|
|
8
|
+
def initialize(message = "Date out of range")
|
|
9
|
+
super(message)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# BS Date out of range error
|
|
14
|
+
class BSDateOutOfRangeError < Error
|
|
15
|
+
def initialize(message = "BS Date out of range")
|
|
16
|
+
super(message)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "date"
|
|
4
|
-
require_relative "../
|
|
4
|
+
require_relative "../converter"
|
|
5
5
|
|
|
6
6
|
# Extension to Ruby's Date class to add Bikram Sambat conversion methods
|
|
7
7
|
class Date
|
|
8
|
-
EPOCH_AD_START = Date.new(1943, 4, 14)
|
|
9
|
-
EPOCH_AD_END = Date.new(2034, 4, 13)
|
|
10
|
-
private_constant :EPOCH_AD_START, :EPOCH_AD_END
|
|
11
|
-
|
|
12
8
|
def to_bs
|
|
13
|
-
|
|
14
|
-
raise DateOutOfRangeError,
|
|
15
|
-
"Date #{self} is out of supported AD Range (1943-04-14 - 2034-04-13)"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
BSDate.from_ad(self)
|
|
9
|
+
EnglishNepaliDateConverter::Converter.to_bs(self)
|
|
19
10
|
end
|
|
20
11
|
end
|
|
@@ -4,29 +4,13 @@ $LOAD_PATH << File.dirname(__FILE__)
|
|
|
4
4
|
|
|
5
5
|
require_relative "englishnepalidateconverter/version"
|
|
6
6
|
require "date"
|
|
7
|
+
require_relative "englishnepalidateconverter/errors"
|
|
7
8
|
require_relative "englishnepalidateconverter/bs_date"
|
|
8
9
|
require_relative "englishnepalidateconverter/bs_calendar"
|
|
10
|
+
require_relative "englishnepalidateconverter/converter"
|
|
9
11
|
require_relative "englishnepalidateconverter/extensions/date"
|
|
10
12
|
require_relative "englishnepalidateconverter/extensions/integer"
|
|
11
13
|
|
|
12
|
-
module EnglishNepaliDateConverter
|
|
13
|
-
class Error < StandardError; end
|
|
14
|
-
|
|
15
|
-
# Date out of range error
|
|
16
|
-
class DateOutOfRangeError < Error
|
|
17
|
-
def initialize(message = "Date out of range")
|
|
18
|
-
super(message)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# BS Date out of range error
|
|
23
|
-
class BSDateOutOfRangeError < Error
|
|
24
|
-
def initialize(message = "BS Date out of range")
|
|
25
|
-
super(message)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
14
|
BSDate = EnglishNepaliDateConverter::BSDate
|
|
31
15
|
DateOutOfRangeError = EnglishNepaliDateConverter::DateOutOfRangeError
|
|
32
16
|
BSDateOutOfRangeError = EnglishNepaliDateConverter::BSDateOutOfRangeError
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
describe EnglishNepaliDateConverter::Converter do
|
|
6
|
+
def bs_parts(bs_date)
|
|
7
|
+
[bs_date.year, bs_date.month, bs_date.day]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe ".to_bs" do
|
|
11
|
+
it "converts an AD date to a BS date" do
|
|
12
|
+
result = described_class.to_bs(Date.new(2025, 9, 3))
|
|
13
|
+
|
|
14
|
+
expect(result).to be_a(EnglishNepaliDateConverter::BSDate)
|
|
15
|
+
expect(bs_parts(result)).to eq([2082, 5, 18])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "converts the first supported AD date" do
|
|
19
|
+
expect(bs_parts(described_class.to_bs(Date.new(1943, 4, 14)))).to eq([2000, 1, 1])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "converts the last supported AD date" do
|
|
23
|
+
expect(bs_parts(described_class.to_bs(Date.new(2034, 4, 13)))).to eq([2090, 12, 30])
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "converts a DateTime late on the last supported day" do
|
|
27
|
+
expect(bs_parts(described_class.to_bs(DateTime.new(2034, 4, 13, 23)))).to eq([2090, 12, 30])
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "raises DateOutOfRangeError before the supported range" do
|
|
31
|
+
expect { described_class.to_bs(Date.new(1943, 4, 13)) }
|
|
32
|
+
.to raise_error(EnglishNepaliDateConverter::DateOutOfRangeError)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "raises DateOutOfRangeError after the supported range" do
|
|
36
|
+
expect { described_class.to_bs(Date.new(2034, 4, 14)) }
|
|
37
|
+
.to raise_error(EnglishNepaliDateConverter::DateOutOfRangeError)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe ".to_ad" do
|
|
42
|
+
it "converts a BSDate to an AD date" do
|
|
43
|
+
result = described_class.to_ad(EnglishNepaliDateConverter::BSDate.new(2082, 5, 18))
|
|
44
|
+
|
|
45
|
+
expect(result).to eq(Date.new(2025, 9, 3))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "converts year, month and day arguments to an AD date" do
|
|
49
|
+
expect(described_class.to_ad(2070, 10, 3)).to eq(Date.new(2014, 1, 17))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "converts the first supported BS date" do
|
|
53
|
+
expect(described_class.to_ad(2000, 1, 1)).to eq(Date.new(1943, 4, 14))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "converts the last supported BS date" do
|
|
57
|
+
expect(described_class.to_ad(2090, 12, 30)).to eq(Date.new(2034, 4, 13))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "raises BSDateOutOfRangeError for a year outside the table" do
|
|
61
|
+
expect { described_class.to_ad(1999, 12, 30) }
|
|
62
|
+
.to raise_error(EnglishNepaliDateConverter::BSDateOutOfRangeError)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "raises BSDateOutOfRangeError for an invalid month" do
|
|
66
|
+
expect { described_class.to_ad(2080, 13, 1) }
|
|
67
|
+
.to raise_error(EnglishNepaliDateConverter::BSDateOutOfRangeError)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "raises BSDateOutOfRangeError for a day that does not exist in the month" do
|
|
71
|
+
expect { described_class.to_ad(2090, 12, 31) }
|
|
72
|
+
.to raise_error(EnglishNepaliDateConverter::BSDateOutOfRangeError)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: englishnepalidateconverter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dlamichhane
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-12-06 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: bundler
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '4.0'
|
|
19
19
|
type: :development
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '4.0'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: pry-byebug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -57,56 +57,56 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '3.
|
|
60
|
+
version: '3.13'
|
|
61
61
|
type: :development
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '3.
|
|
67
|
+
version: '3.13'
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: rubocop
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '1.
|
|
74
|
+
version: '1.93'
|
|
75
75
|
type: :development
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '1.
|
|
81
|
+
version: '1.93'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: rubocop-rake
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
|
-
- - "
|
|
86
|
+
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '0'
|
|
88
|
+
version: '0.7'
|
|
89
89
|
type: :development
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
|
-
- - "
|
|
93
|
+
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '0'
|
|
95
|
+
version: '0.7'
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: rubocop-rspec
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
|
-
- - "
|
|
100
|
+
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
102
|
+
version: '3.11'
|
|
103
103
|
type: :development
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
|
-
- - "
|
|
107
|
+
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
109
|
+
version: '3.11'
|
|
110
110
|
description: Conversion of Gregorian calendar to Nepali Calendar
|
|
111
111
|
email:
|
|
112
112
|
- lamichhanedeepak@gmail.com
|
|
@@ -114,9 +114,12 @@ executables: []
|
|
|
114
114
|
extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
|
116
116
|
files:
|
|
117
|
+
- ".github/workflows/bump-version.yml"
|
|
118
|
+
- ".github/workflows/ci.yml"
|
|
117
119
|
- ".gitignore"
|
|
118
120
|
- ".rspec"
|
|
119
121
|
- ".rubocop.yml"
|
|
122
|
+
- ".ruby-version"
|
|
120
123
|
- Gemfile
|
|
121
124
|
- LICENSE.txt
|
|
122
125
|
- README.md
|
|
@@ -125,10 +128,13 @@ files:
|
|
|
125
128
|
- lib/englishnepalidateconverter.rb
|
|
126
129
|
- lib/englishnepalidateconverter/bs_calendar.rb
|
|
127
130
|
- lib/englishnepalidateconverter/bs_date.rb
|
|
131
|
+
- lib/englishnepalidateconverter/converter.rb
|
|
132
|
+
- lib/englishnepalidateconverter/errors.rb
|
|
128
133
|
- lib/englishnepalidateconverter/extensions/date.rb
|
|
129
134
|
- lib/englishnepalidateconverter/extensions/integer.rb
|
|
130
135
|
- lib/englishnepalidateconverter/version.rb
|
|
131
136
|
- spec/englishnepalidateconverter/bs_date_spec.rb
|
|
137
|
+
- spec/englishnepalidateconverter/converter_spec.rb
|
|
132
138
|
- spec/englishnepalidateconverter/version_spec.rb
|
|
133
139
|
- spec/spec_helper.rb
|
|
134
140
|
homepage: https://github.com/dlamichhane/englishnepalidateconverter
|
|
@@ -142,17 +148,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
142
148
|
requirements:
|
|
143
149
|
- - ">="
|
|
144
150
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '
|
|
151
|
+
version: '4.0'
|
|
146
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
153
|
requirements:
|
|
148
154
|
- - ">="
|
|
149
155
|
- !ruby/object:Gem::Version
|
|
150
156
|
version: '0'
|
|
151
157
|
requirements: []
|
|
152
|
-
rubygems_version:
|
|
158
|
+
rubygems_version: 4.0.20
|
|
153
159
|
specification_version: 4
|
|
154
160
|
summary: Converts the English calendar date to Nepali calendar date
|
|
155
161
|
test_files:
|
|
156
162
|
- spec/englishnepalidateconverter/bs_date_spec.rb
|
|
163
|
+
- spec/englishnepalidateconverter/converter_spec.rb
|
|
157
164
|
- spec/englishnepalidateconverter/version_spec.rb
|
|
158
165
|
- spec/spec_helper.rb
|