Project

youbi

0.0
No release in over a year
Converts Date and Time objects into Japanese weekday names in different formats (kanji, hiragana, katakana, short).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

youbi

Converts Date and Time objects into Japanese weekday names in different formats (kanji, hiragana, katakana, short).

Gem Version

Installation

Add this line to your application's Gemfile:

gem 'youbi'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install youbi

Usage

Get the Japanese weekday name

The japanese_day method can be used with both Date and Time objects.

Example:

require "youbi"

date = Date.new(2025, 2, 10) # 月曜日
time = Time.new(2025, 2, 10, 12, 0, 0) # 月曜日

puts date.japanese_day  # => "月曜日"
puts time.japanese_day  # => "月曜日"

Available Formats

The japanese_day(format: :○○) option allows you to get the weekday in different formats.

Option Example (Monday)
:kanji "月曜日"
:hiragana "げつようび"
:katakana "ゲツヨウビ"
:short "月"

Example:

puts date.japanese_day(format: :hiragana)  # => "げつようび"
puts date.japanese_day(format: :katakana)  # => "ゲツヨウビ"
puts date.japanese_day(format: :short)     # => "月"

Error Handling

If you pass an invalid format to japanese_day, the gem will raise a Youbi::Error.

Example:

begin
  date.japanese_day(format: :invalid_format)
rescue Youbi::Error => e
  puts e.message  # => "Invalid format: invalid_format"
end

Running Tests

You can run tests using RSpec:

bundle exec rspec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ryotaro-shirai/youbi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Youbi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.