Skip to content

Commit

Permalink
rename to DateTimeLocalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
charlieTheBotDev committed Jan 8, 2016
1 parent 6b09a5c commit 4635ee5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions modules/date-localizer/main/index.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class DateLocalizer
class DateTimeLocalizer
zeroPad = hx.format.zeroPad(2)

# get the display order for the date so dates can be displayed correctly when localised
Expand Down Expand Up @@ -77,7 +77,7 @@ class DateLocalizer
new Date('Invalid Date')


class DateLocalizerMoment
class DateTimeLocalizerMoment
dateOrder: ->
date = moment({year:2003, month:11, day:22}).locale(hx.preferences.locale())
dateCheck = date.format('L')
Expand Down Expand Up @@ -164,5 +164,5 @@ class DateLocalizerMoment
else
new Date('Invalid Date')

dateLocalizer = -> if moment? then new DateLocalizerMoment else new DateLocalizer
hx.dateLocalizer = dateLocalizer
dateTimeLocalizer = -> if moment? then new DateTimeLocalizerMoment else new DateTimeLocalizer
hx.dateTimeLocalizer = dateTimeLocalizer
6 changes: 3 additions & 3 deletions modules/date-localizer/test/spec.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
describe 'DateLocalizerMoment', ->
describe 'dateTimeLocalizerMoment', ->
# Not sure how to test this...

describe 'DateLocalizer', ->
localizer = hx.dateLocalizer()
describe 'dateTimeLocalizer', ->
localizer = hx.dateTimeLocalizer()

testDate = new Date(1452130200000) # Thu Jan 07 2016 01:30:00 GMT+0000 (GMT)
zeroHourDate = new Date(1452124800000) # Thu Jan 07 2016 00:00:00 GMT+0000 (GMT)
Expand Down
2 changes: 1 addition & 1 deletion modules/date-picker/main/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class DatePicker extends hx.EventEmitter
_.startDate.setHours(0, 0, 0, 0)
_.endDate.setHours(0, 0, 0, 0)

@localizer = hx.dateLocalizer()
@localizer = hx.dateTimeLocalizer()

@selection = hx.select(@selector).classed('hx-date-picker', true)

Expand Down
2 changes: 1 addition & 1 deletion modules/time-picker/main/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TimePicker extends hx.EventEmitter
hx.preferences.on 'localechange', 'hx.time-picker-' + _.uniqueId, => updateTimePicker this, true
hx.preferences.on 'timezonechange', 'hx.time-picker-' + _.uniqueId, => updateTimePicker this, true

_.localizer = hx.dateLocalizer()
_.localizer = hx.dateTimeLocalizer()

_.selectedDate = new Date
_.selectedDate.setMilliseconds(0)
Expand Down

0 comments on commit 4635ee5

Please sign in to comment.