Giter Club home page Giter Club logo

koyomi's Introduction

koyomi

Build Status Crates.io Crates.io license

This is a calendar for Japanese.

About

  • Generate a calendar
    • Specified a year or year-and-month.
      • e.g. 2018
      • e.g. 2018-01
    • Specified between from and until.
      • e.g. 2018-01 and 2018-12
  • Generate a date
    • Date has year, month, day, weekday and below.
      • Japanese Calendar
      • Japanese weekday
      • Japanese holiday

Usage

Add koyomi as a dependency in your Cargo.toml

[dependencies]
koyomi = "0.3"

Quick Example

Date can be initialized from &str or tuple(i32, u32, u32).

extern crate koyomi;

use koyomi::Date;

// Only "Y-m-d" format
let date = Date::parse("2018-01-01").unwrap();
println!("{}", date); // 2018-01-01

// Same as above
let date = Date::from_ymd(2018, 1, 1).unwrap();
println!("{}", date); // 2018-01-01

Calendar can be initialized from Date or CalendarBuilder.

extern crate koyomi;

use koyomi::{Calendar, Date};

// From `Date`
let from = Date::from_ymd(2018, 1, 1).unwrap();
let until = Date::from_ymd(2018, 12, 31).unwrap();
let calendar = Calendar::new(from, until).unwrap().make();

println!("{}", calendar.len()); // 365
println!("{}", calendar[0]); // 2018-01-01

// From `CalendarBuilder`
let calendar = Calendar::build()
    .from("2018-01")
    .until("2018-12")
    .finalize()
    .unwrap()
    .make();
println!("{}", calendar.len()); // 365
println!("{}", calrndar[0]); // 2018-01-01

koyomi's People

Contributors

kuriho avatar laxect avatar panther-king avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.