-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Localize auto-formatted x-axis date ticks #2261
Merged
alexcjohnson
merged 9 commits into
plotly:master
from
TomDemulierChevret:localise-auto-formatted-x-axis-date-ticks
Jan 30, 2018
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fc86bdb
Localize auto-formatted x-axis date ticks
TomDemulierChevret d5a114f
Merge branch 'master' into localise-auto-formatted-x-axis-date-ticks
TomDemulierChevret aebb07c
changes from @alexcjohnson
TomDemulierChevret 8e257de
Switch back to %-d to avoid space padding
TomDemulierChevret e6250a0
Fix axes_test (missing _extraFormats member in fullLayout parameter p…
TomDemulierChevret d79d00a
Fix lib_date_test (missing extraFormats parameter passed to formatDate)
TomDemulierChevret 14a14d8
Move up formatKeys array to respect syntax declaration order
TomDemulierChevret f90efdc
Fix locale-en.js header syntax
TomDemulierChevret 58acd27
Add new test to localize_test to handle new locale format parameters
TomDemulierChevret 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,10 +1,10 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
|
@@ -32,6 +32,10 @@ module.exports = { | |
decimal: '.', | ||
thousands: ',', | ||
grouping: [3], | ||
currency: ['$', ''] | ||
currency: ['$', ''], | ||
year: '%Y', | ||
month: '%b %Y', | ||
dayMonth: '%b %e', | ||
dayMonthYear: '%b %e, %Y' | ||
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.
|
||
} | ||
}; |
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
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.
modDateFormat
calls out tocomponents/calendars
to get the full spectrum of d3-to-world-cal conversions - you've got the ones needed so far, but others will likely show up, and no need to reinvent the wheel withformatWorld
.At one point there was a performance argument for the structure we have here because we could use precompiled formatters... but we lost that benefit with the original date localization PR #2207, so now I think there would be a much more concise way to do this, something like:
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 suspected that this conversion table existed somewhere but I didn't know exactly where to look (and code search with date/format/etc returned way too many entries).
I like the new proposal, pretty clear to read.
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.
Just test and it does work indeed on my example (only the last
else
is incorrect, need to switch date and time).