-
-
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
Upgrade d3 time format to expose new formatting options for weekdays, weeks and quarters #5026
Changes from all commits
29ea31d
2315777
e92a88c
c877e72
2f7a14e
8cabb47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ var calComponent = require('@src/components/calendars'); | |
// use only the parts of world-calendars that we've imported for our tests | ||
var calendars = require('@src/components/calendars/calendars'); | ||
|
||
var utcFormat = require('d3').time.format.utc; | ||
var utcFormat = require('d3-time-format').utcFormat; | ||
|
||
describe('dates', function() { | ||
'use strict'; | ||
|
@@ -571,15 +571,24 @@ describe('dates', function() { | |
], | ||
[ | ||
'%B \'%y WOY:%U DOW:%w', | ||
'August \'12 WOY:32 DOW:1', | ||
'August \'12 WOY:33 DOW:1', | ||
'Mesori \'28 WOY:## DOW:##' // world-cals doesn't support U or w | ||
], | ||
[ | ||
'%B \'%y QOY:%q WOY:%W DOW:%u', | ||
'August \'12 QOY:3 WOY:33 DOW:1', | ||
'Mesori \'28 QOY:3 WOY:48 DOW:1' | ||
], | ||
[ | ||
'seconds: %s and milliseconds: %Q since UNIX epoch', | ||
'seconds: 1344838774 and milliseconds: 1344838774567 since UNIX epoch', | ||
'seconds: 1344838774 and milliseconds: 1344838774567 since UNIX epoch' | ||
], | ||
[ | ||
'%c && %x && .%2f .%f', // %<n>f is our addition | ||
'Mon Aug 13 06:19:34 2012 && 08/13/2012 && .57 .5678', | ||
'Pes Meso 7 06:19:34 1728 && 12/07/1728 && .57 .5678' | ||
'8/13/2012, 6:19:34 AM && 8/13/2012 && .57 .5678', | ||
'Pes Meso 7 6:19:34 AM 1728 && 12/07/1728 && .57 .5678' | ||
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. According to https://github.com/d3/d3/blob/master/CHANGES.md#time-formats-d3-time-format var now = new Date;
d3.timeFormat("%c")(new Date); // "6/23/2016, 2:01:33 PM"
d3.timeFormat("%x")(new Date); // "6/23/2016"
d3.timeFormat("%X")(new Date); // "2:01:38 PM" |
||
] | ||
|
||
].forEach(function(v) { | ||
var fmt = v[0]; | ||
var expectedGregorian = v[1]; | ||
|
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.
Fixed bug reported in d3/d3-time-format#62.