Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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 February 09, 2012
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 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  ISO8601DateFormatter.m
10  ISO8601DateFormatter.m
@@ -516,6 +516,12 @@ - (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out
516 516
 						}
517 517
 					}
518 518
 				}
  519
+                else // Process minutes and second w/o timeSep
  520
+                {
  521
+                    minute = read_segment_2digits(ch, &ch);
  522
+                    if (isdigit(*ch))
  523
+                        second = read_segment_2digits(ch, &ch);
  524
+                }
519 525
 
520 526
 				if (!strict) {
521 527
 					if (isspace(*ch)) ++ch;
@@ -566,6 +572,10 @@ - (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out
566 572
 			}
567 573
 		}
568 574
 
  575
+        if (timeZone == nil)  // No time zone specified, use local time.
  576
+        {
  577
+            timeZone = [NSTimeZone localTimeZone];
  578
+        }
569 579
 		if (isValidDate) {
570 580
 			components.year = year;
571 581
 			components.day = day;
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.