Skip to content

Commit

Permalink
Fix docs and tests after 8e0f023
Browse files Browse the repository at this point in the history
  • Loading branch information
chpolste committed Aug 3, 2023
1 parent 6326888 commit e4e57d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/src/values.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ <h2 id="date-formatting">Formatting</h2>
<li><code>%%</code>: A literal percent character.</li>
</ul>
<p>
If no specification is given, Date values default to <code>%Y-%m-%d %H:%M:%S</code>.
If no specification is given, Date values default to the original input text or <code>%Y-%m-%d %H:%M:%S</code> if none exists.
</p>

<div class="demo">
Expand Down Expand Up @@ -291,7 +291,7 @@ <h3>Examples</h3>
<h2 id="datedelta-formatting">Formatting</h2>
<p>
DateDelta does not provide formatting options at the moment.
By default values are formatted as <code>+Dd HH:MM:SS</code>.
By default values are returned as they were input or are formatted as <code>+Dd HH:MM:SS</code> if no original input exists.
Use attributes to assemble a custom format.
</p>
</article>
Expand Down
12 changes: 9 additions & 3 deletions test/test_values.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,17 @@ describe("Value formatting", function () {
});

it("DateDeltaValue default format", function() {
let pos = new DateDeltaValue("+5m");
const pos = new DateDeltaValue("+5m");
assert.strictEqual(pos.toString(), "+5m");
pos._TEXT = null; // TODO create a proper mechanism to obtain default formatting
assert.strictEqual(pos.toString(), "+0d 00:05:00");
let neg = new DateDeltaValue("-251h");
const neg = new DateDeltaValue("-251h");
assert.strictEqual(neg.toString(), "-251h");
neg._TEXT = null; // TODO create a proper mechanism to obtain default formatting
assert.strictEqual(neg.toString(), "-10d 11:00:00");
let zero = new DateDeltaValue("0d");
const zero = new DateDeltaValue("0d");
assert.strictEqual(zero.toString(), "0d");
zero._TEXT = null; // TODO create a proper mechanism to obtain default formatting
assert.strictEqual(zero.toString(), "+0d 00:00:00");
});

Expand Down

0 comments on commit e4e57d3

Please sign in to comment.