Skip to content

Commit

Permalink
Add options for no space before day/month, add option for showing yea…
Browse files Browse the repository at this point in the history
…r first
  • Loading branch information
Emma Jamieson authored and icambron committed Jul 23, 2019
1 parent 84101ca commit ea95d28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

* **1.2.1**: Add formatting for japanese dates

* **1.2.1**: Fix for AMD support

* **1.2.0**: Add basic internationalization
Expand Down
9 changes: 6 additions & 3 deletions src/twix.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ makeTwix = (moment) ->
options =
groupMeridiems: true
spaceBeforeMeridiem: true
spaceBeforeMonth: true
spaceBeforeDay: true
showDayOfWeek: false
showYearFirst: false
hideTime: false
hideYear: false
implicitMinutes: true
Expand Down Expand Up @@ -275,7 +278,7 @@ makeTwix = (moment) ->
name: 'year',
fn: (date) -> date.format options.yearFormat
pre: if americanish then ', ' else ' '
slot: 4
slot: if options.showYearFirst then -1 else 4

if atomicMonthDate && needDate
fs.push
Expand All @@ -295,14 +298,14 @@ makeTwix = (moment) ->
fs.push
name: 'month'
fn: (date) -> date.format options.monthFormat
pre: ' '
pre: if options.spaceBeforeMonth then ' ' else ''
slot: if americanish then 2 else 3

if !atomicMonthDate && needDate
fs.push
name: 'date'
fn: (date) -> date.format options.dayFormat
pre: ' '
pre: if options.spaceBeforeDay then ' ' else ''
slot: if americanish then 3 else 2

if needDate && options.showDayOfWeek
Expand Down

0 comments on commit ea95d28

Please sign in to comment.