Skip to content

Commit

Permalink
Fix UA strings
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed May 13, 2016
1 parent 6a3e55b commit 15544a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ExtDate extends Date {

if (this.approximate.value) {
values = this.approximate.marks(values, '~')
.map(value => value.replace(/~\?/, '%'))
.map(value => value.replace(/(~\?)|(\?~)/, '%'))
}

return values.join('-')
Expand Down
10 changes: 10 additions & 0 deletions test/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ describe('Date', () => {
values: [2004, 5, 11], uncertain: 'month', approximate: 'month'
}).edtf).to.eql('2004-%06-11'))

it('YYYY%-MM-DD', () =>
expect(new Date({
values: [2004, 5, 11], uncertain: 'year', approximate: 'year'
}).edtf).to.eql('2004%-06-11'))

it('YYYY?-MM~-DD', () =>
expect(new Date({
values: [2004, 5, 11], uncertain: 'year', approximate: 'xxxxxxdd'
}).edtf).to.eql('2004?-06~-11'))

it('YYYY?-MM-?DD', () =>
expect(new Date({
values: [2004, 5, 11], uncertain: 'xxxxmmxx'
Expand Down

0 comments on commit 15544a2

Please sign in to comment.