Skip to content

Commit

Permalink
Support formating with '\n'
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Sep 11, 2019
1 parent ff7b6e1 commit 3621e4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/format/index.js
Expand Up @@ -29,7 +29,7 @@ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g

var escapedStringRegExp = /^'(.*?)'?$/
var escapedStringRegExp = /^'([^]*?)'?$/
var doubleQuoteRegExp = /''/g
var unescapedLatinCharacterRegExp = /[a-zA-Z]/

Expand Down
5 changes: 5 additions & 0 deletions src/format/test.js
Expand Up @@ -50,6 +50,11 @@ describe('format', function() {
assert(format(date, "''h 'o''clock'''") === "'5 o'clock'")
})

it('accepts new line charactor', function() {
var date = new Date(2014, 3, 4, 5)
assert.equal(format(date, "yyyy-MM-dd'\n'HH:mm:ss"), '2014-04-04\n05:00:00')
})

describe('ordinal numbers', function() {
it('ordinal day of an ordinal month', function() {
var result = format(date, "do 'day of the' Mo 'month of' yyyy")
Expand Down

0 comments on commit 3621e4b

Please sign in to comment.