Skip to content

Commit

Permalink
fix: count months from 1 (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsndr authored Jun 8, 2024
1 parent 74e8ead commit c99cd5b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 56 deletions.
24 changes: 12 additions & 12 deletions lib/js/month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ use napi_derive::napi;

#[napi(js_name = "Month")]
pub enum Month {
January,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December,
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
September = 9,
October = 10,
November = 11,
December = 12,
}

impl Into<month::Month> for Month {
Expand Down
20 changes: 0 additions & 20 deletions lib/rrule/month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,6 @@ impl FromStr for Month {
}
}

impl From<&u8> for Month {
fn from(month: &u8) -> Self {
match month {
1 => Month::January,
2 => Month::February,
3 => Month::March,
4 => Month::April,
5 => Month::May,
6 => Month::June,
7 => Month::July,
8 => Month::August,
9 => Month::September,
10 => Month::October,
11 => Month::November,
12 => Month::December,
_ => panic!("Invalid month number: {}", month),
}
}
}

impl Into<chrono::Month> for &Month {
fn into(self) -> chrono::Month {
match self {
Expand Down
24 changes: 12 additions & 12 deletions src/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ export enum Frequency {
Secondly = 6
}
export enum Month {
January = 0,
February = 1,
March = 2,
April = 3,
May = 4,
June = 5,
July = 6,
August = 7,
September = 8,
October = 9,
November = 10,
December = 11
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
September = 9,
October = 10,
November = 11,
December = 12
}
export interface NWeekday {
n?: number
Expand Down
24 changes: 12 additions & 12 deletions src/rrule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ export enum Frequency {
}

export enum Month {
January = 0,
February = 1,
March = 2,
April = 3,
May = 4,
June = 5,
July = 6,
August = 7,
September = 8,
October = 9,
November = 10,
December = 11,
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
September = 9,
October = 10,
November = 11,
December = 12,
}

export enum Weekday {
Expand Down

0 comments on commit c99cd5b

Please sign in to comment.