Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromString() throws an Invalid date error #202

Closed
sajinshrestha opened this issue Mar 30, 2018 · 1 comment
Closed

fromString() throws an Invalid date error #202

sajinshrestha opened this issue Mar 30, 2018 · 1 comment

Comments

@sajinshrestha
Copy link

sajinshrestha commented Mar 30, 2018

Steps to reproduce:

  • create a rule using the dtstart date 01/01/0990
  • run rule.toString()
  • convert the string output back to rrule using RRule.fromString()

Validation fails in untilStringToDate.

const new_rule = new RRule({ 
  dtstart: new Date(990, 0, 1)
});

const rule_string = new_rule.toString(); // this works
// toString() => "DTSTART=9900101T060000Z"

const rule = RRule.fromString(rule_string); // errors
// fromString() => Error: Invalid UNTIL value: 9900101T060000Z

See runkit example .

@sajinshrestha
Copy link
Author

sajinshrestha commented Mar 30, 2018

new_rule.toString() string is stripping out the leading 0 from the output. It is returning 9900101T060000Z instead of 09900101T060000Z

toString() seems to be doing the right thing.
new Date(new Date(990, 0, 1).getUTCFullYear() will return 990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant