-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use luxon #519
Open
robinvrd
wants to merge
10
commits into
adopted-ember-addons:master
Choose a base branch
from
concordnow:use-luxon
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Use luxon #519
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9cf531b
Remove testdouble
robinvrd 09dd610
Install ember-auto-import & webpack
robinvrd 8dc6474
Upgrade ember-cli-babel
robinvrd 5afbdba
Install luxon
robinvrd 3bf86da
Replace moment with luxon in mixin
robinvrd e0f14b9
Adapt days order to Luxon ISO order
robinvrd 9f4153c
Load i18n in pikaday-inputless in dummy app
robinvrd 90e790f
Adapt formats to Luxon format tokens
robinvrd 5c573bb
Remove ember-cli-moment-shim
robinvrd be67c96
Update README to replace momentjs with luxon
robinvrd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
module.exports = { | ||
normalizeEntityName() {}, | ||
|
||
afterInstall() { | ||
return this.addAddonToProject('ember-cli-moment-shim', '^3.0.1'); | ||
} | ||
afterInstall() {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
import EmberObject from '@ember/object'; | ||
import moment from 'moment'; | ||
import { Info } from 'luxon'; | ||
|
||
export default { | ||
name: 'setup-pikaday-i18n', | ||
initialize() { | ||
const i18n = EmberObject.extend({ | ||
previousMonth: 'Vorheriger Monat', | ||
nextMonth: 'Nächster Monat', | ||
months: moment.localeData().months(), | ||
weekdays: moment.localeData().weekdays(), | ||
weekdaysShort: moment.localeData().weekdaysShort() | ||
months: Info.months(), | ||
weekdays: Info.weekdays(), | ||
weekdaysShort: Info.weekdays('short') | ||
}); | ||
|
||
const container = arguments[0]; | ||
const application = arguments[1] || container; | ||
|
||
container.register('pikaday-i18n:main', i18n, { singleton: true }); | ||
application.inject('component:pikaday-input', 'i18n', 'pikaday-i18n:main'); | ||
application.inject( | ||
'component:pikaday-inputless', | ||
'i18n', | ||
'pikaday-i18n:main' | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,28 +3,28 @@ | |
{{outlet}} | ||
|
||
Standalone datepicker: | ||
<PikadayInput | ||
@format="dddd MMMM Do YYYY, h:mm:ss a" | ||
@theme="dark-theme" | ||
@onSelection={{action "doSomethingWithSelectedValue"}} | ||
<PikadayInput | ||
@format="cccc LLLL d yyyy, h:mm:ss a" | ||
@theme="dark-theme" | ||
@onSelection={{action "doSomethingWithSelectedValue"}} | ||
/> | ||
|
||
<br> | ||
|
||
Datepicker with minDate set to today (<Input @type="checkbox" @checked={{isMinDateSet}} />) and maxDate set to today (<Input @type="checkbox" @checked={{isMaxDateSet}} />): | ||
<PikadayInput | ||
@minDate={{if this.isMinDateSet this.today null}} | ||
@maxDate={{if this.isMaxDateSet this.today null}} | ||
@value={{someDate}} | ||
@onSelection={{action (mut someDate)}} | ||
<PikadayInput | ||
@minDate={{if this.isMinDateSet this.today null}} | ||
@maxDate={{if this.isMaxDateSet this.today null}} | ||
@value={{someDate}} | ||
@onSelection={{action (mut someDate)}} | ||
/> | ||
<br> | ||
|
||
Datepicker with bound and set value: | ||
<PikadayInput | ||
@value={{this.startDate}} | ||
@onSelection={{action (mut this.startDate)}} | ||
@format="DD.MM.YYYY" | ||
<PikadayInput | ||
@value={{this.startDate}} | ||
@onSelection={{action (mut this.startDate)}} | ||
@format="dd.LL.yyyy" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need |
||
/> | ||
{{this.startDate}} | ||
<br> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ import { render, click, fillIn, settled } from '@ember/test-helpers'; | |
import findAll from 'ember-pikaday/test-support/-private/find-all'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import { close as closePikaday, Interactor } from 'ember-pikaday/test-support'; | ||
import td from 'testdouble'; | ||
|
||
const getFirstWeekendDayNumber = function() { | ||
const date = new Date(); | ||
|
@@ -107,43 +106,46 @@ module('Integration | Component | pikaday-input', function(hooks) { | |
}); | ||
|
||
test('opening picker should send an action', async function(assert) { | ||
const onOpen = td.function(); | ||
this.set('onOpen', onOpen); | ||
const done = assert.async(); | ||
this.set('onOpen', function() { | ||
assert.ok(true); | ||
done(); | ||
}); | ||
|
||
await render(hbs` | ||
<PikadayInput @onOpen={{action this.onOpen}}/> | ||
`); | ||
|
||
await click('input'); | ||
|
||
assert.verify(onOpen()); | ||
}); | ||
|
||
test('closing picker should send an action', async function(assert) { | ||
const onClose = td.function(); | ||
this.set('onClose', onClose); | ||
const done = assert.async(); | ||
this.set('onClose', function() { | ||
assert.ok(true); | ||
done(); | ||
}); | ||
|
||
await render(hbs` | ||
<PikadayInput @onClose={{action this.onClose}}/> | ||
`); | ||
|
||
await click('input'); | ||
await closePikaday(); | ||
|
||
assert.verify(onClose()); | ||
}); | ||
|
||
test('redrawing picker should send an action', async function(assert) { | ||
const onDraw = td.function(); | ||
this.set('onDraw', onDraw); | ||
const done = assert.async(); | ||
this.set('onDraw', function() { | ||
assert.ok(true); | ||
done(); | ||
}); | ||
|
||
await render(hbs` | ||
<PikadayInput @onDraw={{action this.onDraw}}/> | ||
`); | ||
|
||
await click('input'); | ||
|
||
assert.verify(onDraw()); | ||
}); | ||
|
||
test('setting the value attribute should select the correct date', async function(assert) { | ||
|
@@ -172,7 +174,7 @@ module('Integration | Component | pikaday-input', function(hooks) { | |
|
||
test('format of the input is changeable', async function(assert) { | ||
this.set('value', new Date(2010, 7, 10)); | ||
this.set('format', 'YYYY.DD.MM'); | ||
this.set('format', 'yyyy.dd.LL'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need |
||
|
||
await render(hbs` | ||
<PikadayInput @value={{this.value}} @format={{this.format}}/> | ||
|
@@ -527,7 +529,7 @@ module('Integration | Component | pikaday-input', function(hooks) { | |
); | ||
}); | ||
|
||
test('firstDay defaults to Monday (1)', async function(assert) { | ||
test('firstDay defaults to Monday', async function(assert) { | ||
await render(hbs` | ||
<PikadayInput/> | ||
`); | ||
|
@@ -541,7 +543,7 @@ module('Integration | Component | pikaday-input', function(hooks) { | |
|
||
test('firstDay option overrides the default first day value', async function(assert) { | ||
await render(hbs` | ||
<PikadayInput @firstDay={{0}}/> | ||
<PikadayInput @firstDay={{6}}/> | ||
`); | ||
|
||
await click('input'); | ||
|
@@ -552,16 +554,17 @@ module('Integration | Component | pikaday-input', function(hooks) { | |
}); | ||
|
||
test('if an options hash is passed, default options are overridden', async function(assert) { | ||
const onOpen = td.function(); | ||
this.set('onOpen', onOpen); | ||
const done = assert.async(); | ||
this.set('onOpen', function() { | ||
assert.ok(true); | ||
done(); | ||
}); | ||
|
||
await render(hbs` | ||
<PikadayInput @options={{hash onOpen=onOpen disableWeekends=true}}/> | ||
`); | ||
await click('input'); | ||
|
||
assert.verify(onOpen()); | ||
|
||
const weekendDay = getFirstWeekendDayNumber(); | ||
const disabledWeekendCell = findAll('td', document.body).find( | ||
getDisabledDayCB(weekendDay) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need