-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from stefanpenner/locale-support
Adding locale and moment computeds
- Loading branch information
Showing
30 changed files
with
478 additions
and
217 deletions.
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import moment from 'moment'; | ||
|
||
import computedFactory from './-base'; | ||
|
||
export default computedFactory(function calendarComputed(params) { | ||
if (!params || params && params.length > 2) { | ||
throw new TypeError('ember-moment: Invalid Number of arguments, at most 2'); | ||
} | ||
|
||
const [ date, referenceTime ] = params; | ||
|
||
return moment(date).calendar(referenceTime); | ||
}); |
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import moment from 'moment'; | ||
import computedFactory from './-base'; | ||
|
||
export default computedFactory(function humanizeComputed([duration, suffixless]) { | ||
if (!moment.isDuration(duration)) { | ||
duration = moment.duration(duration); | ||
} | ||
|
||
return duration.humanize(suffixless); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import moment from 'moment'; | ||
|
||
import computedFactory from './-base'; | ||
|
||
export default computedFactory(function localeComputed([date, locale]) { | ||
if (!moment.isDuration(date)) { | ||
date = moment(date); | ||
} | ||
|
||
return date.locale(locale); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import moment from 'moment'; | ||
|
||
import computedFactory from './-base'; | ||
|
||
export default computedFactory(function momentComputed(params) { | ||
return moment(...params); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import moment from 'moment'; | ||
|
||
import computedFactory from './-base'; | ||
|
||
export default computedFactory(function tzComputed([date, tz]) { | ||
return moment(date).tz(tz); | ||
}); |
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,3 +1,16 @@ | ||
html, body { | ||
margin: 20px; | ||
font-family: Helvetica, sans-serif; | ||
font-size: 14px; | ||
} | ||
|
||
.example { | ||
padding: 5px; | ||
margin: 2px 0; | ||
background: #f1f1f1; | ||
} | ||
|
||
code { | ||
color: #333; | ||
font-size: 13px; | ||
} |
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,3 +1,3 @@ | ||
<h2 id="title">Welcome to Ember.js</h2> | ||
<h2 id="title">ember-moment</h2> | ||
|
||
{{outlet}} | ||
{{outlet}} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="example"> | ||
{{moment-calendar now lastHour}} | ||
<code> | ||
\{{moment-calendar now lastHour}} | ||
</code> | ||
</div> |
Oops, something went wrong.