-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat: Add correct Estonian relativeTime locale for past and future tense #790
Merged
iamkun
merged 4 commits into
iamkun:dev
from
HarlesPilter:feature/et-relative-time-locale
Jan 30, 2020
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9aef332
feat: Add correct Estonian relativeTime locale for past and future tense
HarlesPilter 1ae7d91
feat: Refactor code to match more the moment implementation
HarlesPilter c720edc
feat: Add tests for et locale
HarlesPilter 33905ae
fix: Remove unnecessary line
HarlesPilter 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import moment from 'moment' | ||
import MockDate from 'mockdate' | ||
import dayjs from '../../src' | ||
import relativeTime from '../../src/plugin/relativeTime' | ||
import '../../src/locale/et' | ||
|
||
dayjs.extend(relativeTime) | ||
|
||
beforeEach(() => { | ||
MockDate.set(new Date()) | ||
}) | ||
|
||
afterEach(() => { | ||
MockDate.reset() | ||
}) | ||
|
||
it('RelativeTime: Time from X', () => { | ||
const T = [ | ||
[44.4, 'second'], // a few seconds | ||
[89.5, 'second'], // a minute | ||
[43, 'minute'], // 44 minutes | ||
[21, 'hour'], // 21 hours | ||
[25, 'day'], // 25 days | ||
[10, 'month'], // 2 month | ||
[18, 'month'] // 2 years | ||
] | ||
|
||
T.forEach((t) => { | ||
dayjs.locale('et') | ||
moment.locale('et') | ||
expect(dayjs().from(dayjs().add(t[0], t[1]))) | ||
.toBe(moment().from(moment().add(t[0], t[1]))) | ||
expect(dayjs().from(dayjs().subtract(t[0], t[1]))) | ||
.toBe(moment().from(moment().subtract(t[0], t[1]))) | ||
expect(dayjs().from(dayjs().add(t[0], t[1]), true)) | ||
.toBe(moment().from(moment().add(t[0], t[1]), true)) | ||
}) | ||
}) |
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.
Think we don't need this line?
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.
Yeah, I wondered why that was there since I don't think moment uses it either.