Skip to content

Commit

Permalink
Merge pull request #67 from legalthings/moment-tostring
Browse files Browse the repository at this point in the history
Add moment.fn.toString
  • Loading branch information
jasny authored Jul 5, 2017
2 parents a9cf0aa + 1251859 commit 1ad5895
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h1>LegalForm.js demo</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ractive/0.9.0-build-117/ractive.min.js"></script>
<script src="https://cdn.rawgit.com/jmespath/jmespath.js/master/jmespath.js"></script>

<script src="js/moment-custom.js"></script>
<script src="js/define-property.js"></script>
<script src="js/escape-dots.js"></script>
<script src="js/unescape-dots.js"></script>
Expand Down
5 changes: 5 additions & 0 deletions js/moment-custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Use default date for moment
moment.fn.toString = function() {
if (typeof this.defaultFormat === 'undefined') return this.toDate().toString();
return this.format(this.defaultFormat);
};
1 change: 1 addition & 0 deletions material.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ <h1>LegalForm.js demo with Material Design</h1>
<script src="https://cdn.rawgit.com/jmespath/jmespath.js/master/jmespath.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.5.10/js/material.min.js"></script>

<script src="js/moment-custom.js"></script>
<script src="js/define-property.js"></script>
<script src="js/escape-dots.js"></script>
<script src="js/unescape-dots.js"></script>
Expand Down
1 change: 1 addition & 0 deletions nomaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ <h1>LegalForm.js demo with Material Design</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ractive/0.9.0-build-117/ractive.min.js"></script>
<script src="https://cdn.rawgit.com/jmespath/jmespath.js/master/jmespath.js"></script>

<script src="js/moment-custom.js"></script>
<script src="js/define-property.js"></script>
<script src="js/escape-dots.js"></script>
<script src="js/unescape-dots.js"></script>
Expand Down

0 comments on commit 1ad5895

Please sign in to comment.