Skip to content

Commit

Permalink
v1.24.0: add parsing of date strings according to given format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogier Schouten committed Nov 5, 2015
1 parent 4a7b380 commit 74968d2
Show file tree
Hide file tree
Showing 63 changed files with 2,465 additions and 173 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ var amsterdamDateNoDst = new tc.DateTime(2014, 1, 1, 13, 59, 59, 0, tc.zone("Eur
// date from ISO 8601 string
var amsterdamDateFromString = new tc.DateTime("2014-01-01T13:59:59.000 Europe/Amsterdam");

// date from other string format
var unitedStatesDate = new tc.DateTime("12/31/2015 23:44:55.123 America/Chicago", "MM/dd/yyyy HH:mm:ss.SSS zzzz");

// date from an Excel datetime number
var dt = tc.DateTime.fromExcel(42005.5430555556); // 2015-01-01T13:02:00

Expand Down Expand Up @@ -671,6 +674,10 @@ The version of the included IANA time zone database is 2015g.

## Changelog

### 1.24.0 (2015-11-05)
* Add new DateTime constructor that accepts a date string and a format string to parse dates in a given format
* Add new static method DateTime.parse() that does the same.

### 1.23.0 (2015-10-02)
* Add a static method DateTime.exists() to see whether a given date exists in its time zone

Expand Down
261 changes: 229 additions & 32 deletions dist/timezonecomplete.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/assets/js/search.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions doc/classes/_basics_.timestruct.html
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ <h4 class="tsd-returns-title">Returns <a href="_basics_.timestruct.html" class="
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
259 changes: 177 additions & 82 deletions doc/classes/_datetime_.datetime.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions doc/classes/_duration_.duration.html
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,9 @@ <h4 class="tsd-returns-title">Returns <a href="_duration_.duration.html" class="
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_period_.period.html
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,9 @@ <h4 class="tsd-returns-title">Returns <a href="../enums/_basics_.timeunit.html"
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class="current tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_timesource_.realtimesource.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Date</spa
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_timezone_.timezone.html
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,9 @@ <h4 class="tsd-returns-title">Returns <a href="_timezone_.timezone.html" class="
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_token_.tokenizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</spa
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_tz_database_.ruleinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</s
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_tz_database_.transition.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ <h3>offset</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_tz_database_.tzdatabase.html
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@ <h4 class="tsd-returns-title">Returns <a href="_tz_database_.tzdatabase.html" cl
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/_tz_database_.zoneinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ <h3>until</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_basics_.timeunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ <h3>Year</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_basics_.weekday.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ <h3>Wednesday</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_javascript_.datefunctions.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ <h3>GetUTC</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_period_.perioddst.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ <h3>Regular<wbr>Local<wbr>Time</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class="current tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_timezone_.normalizeoption.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ <h3>Up</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_timezone_.timezonekind.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ <h3>Proper</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_token_.datetimetokentype.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ <h3>ZONE</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.attype.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ <h3>Wall</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.normalizeoption.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ <h3>Up</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.ontype.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ <h3>LeqX</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.ruletype.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ <h3>Rule<wbr>Name</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.totype.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ <h3>Year</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.tzdaynames.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ <h3>Wed</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
3 changes: 3 additions & 0 deletions doc/enums/_tz_database_.tzmonthnames.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ <h3>Sep</h3>
<li class=" tsd-kind-external-module">
<a href="../modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="../modules/_period_.html">"period"</a>
</li>
Expand Down
4 changes: 4 additions & 0 deletions doc/globals.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h3>External modules</h3>
<li class="tsd-kind-external-module"><a href="modules/_index_.html" class="tsd-kind-icon">"index"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_javascript_.html" class="tsd-kind-icon">"javascript"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_math_.html" class="tsd-kind-icon">"math"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_parse_.html" class="tsd-kind-icon">"parse"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_period_.html" class="tsd-kind-icon">"period"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_strings_.html" class="tsd-kind-icon">"strings"</a></li>
<li class="tsd-kind-external-module"><a href="modules/_timesource_.html" class="tsd-kind-icon">"timesource"</a></li>
Expand Down Expand Up @@ -121,6 +122,9 @@ <h3>External modules</h3>
<li class=" tsd-kind-external-module">
<a href="modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_period_.html">"period"</a>
</li>
Expand Down
17 changes: 14 additions & 3 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ <h3 id="datetime">DateTime</h3>
<span class="hljs-comment">// date from ISO 8601 string</span>
<span class="hljs-keyword">var</span> amsterdamDateFromString = <span class="hljs-keyword">new</span> tc.DateTime(<span class="hljs-string">"2014-01-01T13:59:59.000 Europe/Amsterdam"</span>);

<span class="hljs-comment">// date from other string format</span>
<span class="hljs-keyword">var</span> unitedStatesDate = <span class="hljs-keyword">new</span> tc.DateTime(<span class="hljs-string">"12/31/2015 23:44:55.123 America/Chicago"</span>, <span class="hljs-string">"MM/dd/yyyy HH:mm:ss.SSS zzzz"</span>);

<span class="hljs-comment">// date from an Excel datetime number</span>
<span class="hljs-keyword">var</span> dt = tc.DateTime.fromExcel(<span class="hljs-number">42005.5430555556</span>); <span class="hljs-comment">// 2015-01-01T13:02:00</span>

Expand Down Expand Up @@ -674,6 +677,11 @@ <h3 id="does-timezonecomplete-handle-leap-seconds-">Does timezonecomplete handle
<h2 id="current-tz-database-version-">Current TZ database version:</h2>
<p>The version of the included IANA time zone database is 2015g.</p>
<h2 id="changelog">Changelog</h2>
<h3 id="1-24-0-2015-11-05-">1.24.0 (2015-11-05)</h3>
<ul>
<li>Add new DateTime constructor that accepts a date string and a format string to parse dates in a given format</li>
<li>Add new static method DateTime.parse() that does the same.</li>
</ul>
<h3 id="1-23-0-2015-10-02-">1.23.0 (2015-10-02)</h3>
<ul>
<li>Add a static method DateTime.exists() to see whether a given date exists in its time zone</li>
Expand Down Expand Up @@ -977,9 +985,9 @@ <h3 id="1-0-0-2014-06-26-">1.0.0 (2014-06-26)</h3>
</ul>
<h2 id="contributors">Contributors</h2>
<ul>
<li>Rogier Schouten <a href="&#109;&#97;&#105;&#108;&#116;&#x6f;&#58;&#114;&#x2e;&#x73;&#99;&#104;&#x6f;&#x75;&#116;&#101;&#x6e;&#x40;&#115;&#x70;&#105;&#114;&#105;&#116;&#105;&#116;&#x2e;&#99;&#111;&#x6d;">&#114;&#x2e;&#x73;&#99;&#104;&#x6f;&#x75;&#116;&#101;&#x6e;&#x40;&#115;&#x70;&#105;&#114;&#105;&#116;&#105;&#116;&#x2e;&#99;&#111;&#x6d;</a></li>
<li>Daan Wissing <a href="&#x6d;&#97;&#x69;&#x6c;&#116;&#111;&#58;&#x64;&#46;&#x77;&#x69;&#115;&#x73;&#x69;&#110;&#103;&#x40;&#x73;&#x70;&#x69;&#114;&#105;&#116;&#x69;&#x74;&#x2e;&#x63;&#x6f;&#x6d;">&#x64;&#46;&#x77;&#x69;&#115;&#x73;&#x69;&#110;&#103;&#x40;&#x73;&#x70;&#x69;&#114;&#105;&#116;&#x69;&#x74;&#x2e;&#x63;&#x6f;&#x6d;</a></li>
<li>Peter Kooijmans <a href="&#109;&#97;&#105;&#x6c;&#x74;&#x6f;&#58;&#x70;&#46;&#x6b;&#x6f;&#x6f;&#x69;&#x6a;&#x6d;&#97;&#x6e;&#x73;&#64;&#115;&#112;&#x69;&#114;&#105;&#116;&#105;&#x74;&#x2e;&#x63;&#x6f;&#x6d;">&#x70;&#46;&#x6b;&#x6f;&#x6f;&#x69;&#x6a;&#x6d;&#97;&#x6e;&#x73;&#64;&#115;&#112;&#x69;&#114;&#105;&#116;&#105;&#x74;&#x2e;&#x63;&#x6f;&#x6d;</a></li>
<li>Rogier Schouten <a href="&#109;&#97;&#x69;&#x6c;&#116;&#x6f;&#x3a;&#x72;&#46;&#115;&#99;&#104;&#x6f;&#117;&#116;&#x65;&#x6e;&#64;&#115;&#112;&#x69;&#114;&#105;&#116;&#105;&#116;&#46;&#99;&#111;&#109;">&#x72;&#46;&#115;&#99;&#104;&#x6f;&#117;&#116;&#x65;&#x6e;&#64;&#115;&#112;&#x69;&#114;&#105;&#116;&#105;&#116;&#46;&#99;&#111;&#109;</a></li>
<li>Daan Wissing <a href="&#109;&#x61;&#x69;&#x6c;&#116;&#x6f;&#x3a;&#100;&#x2e;&#x77;&#x69;&#115;&#x73;&#105;&#110;&#x67;&#64;&#115;&#x70;&#x69;&#x72;&#x69;&#116;&#x69;&#116;&#46;&#99;&#x6f;&#109;">&#100;&#x2e;&#x77;&#x69;&#115;&#x73;&#105;&#110;&#x67;&#64;&#115;&#x70;&#x69;&#x72;&#x69;&#116;&#x69;&#116;&#46;&#99;&#x6f;&#109;</a></li>
<li>Peter Kooijmans <a href="&#109;&#97;&#x69;&#108;&#116;&#x6f;&#58;&#112;&#x2e;&#107;&#111;&#111;&#x69;&#106;&#x6d;&#97;&#110;&#115;&#64;&#115;&#112;&#105;&#x72;&#105;&#x74;&#105;&#116;&#x2e;&#x63;&#111;&#109;">&#112;&#x2e;&#107;&#111;&#111;&#x69;&#106;&#x6d;&#97;&#110;&#115;&#64;&#115;&#112;&#105;&#x72;&#105;&#x74;&#105;&#116;&#x2e;&#x63;&#111;&#109;</a></li>
</ul>
<h2 id="license">License</h2>
<p>MIT</p>
Expand Down Expand Up @@ -1015,6 +1023,9 @@ <h2 id="license">License</h2>
<li class=" tsd-kind-external-module">
<a href="modules/_math_.html">"math"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_parse_.html">"parse"</a>
</li>
<li class=" tsd-kind-external-module">
<a href="modules/_period_.html">"period"</a>
</li>
Expand Down
Loading

0 comments on commit 74968d2

Please sign in to comment.