Skip to content

Commit e4e57d3

Browse files
committed
Fix docs and tests after 8e0f023
1 parent 6326888 commit e4e57d3

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

docs/src/values.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ <h2 id="date-formatting">Formatting</h2>
202202
<li><code>%%</code>: A literal percent character.</li>
203203
</ul>
204204
<p>
205-
If no specification is given, Date values default to <code>%Y-%m-%d %H:%M:%S</code>.
205+
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.
206206
</p>
207207

208208
<div class="demo">
@@ -291,7 +291,7 @@ <h3>Examples</h3>
291291
<h2 id="datedelta-formatting">Formatting</h2>
292292
<p>
293293
DateDelta does not provide formatting options at the moment.
294-
By default values are formatted as <code>+Dd HH:MM:SS</code>.
294+
By default values are returned as they were input or are formatted as <code>+Dd HH:MM:SS</code> if no original input exists.
295295
Use attributes to assemble a custom format.
296296
</p>
297297
</article>

test/test_values.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,17 @@ describe("Value formatting", function () {
120120
});
121121

122122
it("DateDeltaValue default format", function() {
123-
let pos = new DateDeltaValue("+5m");
123+
const pos = new DateDeltaValue("+5m");
124+
assert.strictEqual(pos.toString(), "+5m");
125+
pos._TEXT = null; // TODO create a proper mechanism to obtain default formatting
124126
assert.strictEqual(pos.toString(), "+0d 00:05:00");
125-
let neg = new DateDeltaValue("-251h");
127+
const neg = new DateDeltaValue("-251h");
128+
assert.strictEqual(neg.toString(), "-251h");
129+
neg._TEXT = null; // TODO create a proper mechanism to obtain default formatting
126130
assert.strictEqual(neg.toString(), "-10d 11:00:00");
127-
let zero = new DateDeltaValue("0d");
131+
const zero = new DateDeltaValue("0d");
132+
assert.strictEqual(zero.toString(), "0d");
133+
zero._TEXT = null; // TODO create a proper mechanism to obtain default formatting
128134
assert.strictEqual(zero.toString(), "+0d 00:00:00");
129135
});
130136

0 commit comments

Comments
 (0)