Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Process minutes & seconds, and default to local time zone if not specified #1

Closed
wants to merge 1 commit into from

2 participants

Henry Chan Gopal Patel
Henry Chan

In processing the time, I noticed that the minutes and seconds were not being processed if the format did not include component separators. E.g. T143000Z. Also if the timezone is not specified, the local time zone should be used. E.g. T143000, should set the timezone to local.

Gopal Patel
Owner

Thanks for the pull request @henry-chan-git. Unfortunately, I'm not the maintainer of this libary -- this is just a git mirror of @boredzo's mercurial repo at https://bitbucket.org/boredzo/iso-8601-parser-unparser.

I recommend sending your patches to him, and I'll update this mirror when they are committed. Thanks!

Gopal Patel nixme closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 ISO8601DateFormatter.m
10 ISO8601DateFormatter.m
View
@@ -516,6 +516,12 @@ - (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out
}
}
}
+ else // Process minutes and second w/o timeSep
+ {
+ minute = read_segment_2digits(ch, &ch);
+ if (isdigit(*ch))
+ second = read_segment_2digits(ch, &ch);
+ }
if (!strict) {
if (isspace(*ch)) ++ch;
@@ -566,6 +572,10 @@ - (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out
}
}
+ if (timeZone == nil) // No time zone specified, use local time.
+ {
+ timeZone = [NSTimeZone localTimeZone];
+ }
if (isValidDate) {
components.year = year;
components.day = day;
Something went wrong with that request. Please try again.