Merge pull request #4884 from reppners/d3

fixed multi time format
This commit is contained in:
Masahiro Wakame
2015-07-13 22:37:29 +09:00
2 changed files with 15 additions and 1 deletions
+13
View File
@@ -2677,4 +2677,17 @@ function testD3Events () {
console.log('shift + ' + d3.event.which);
}
});
}
function testD3MutlieTimeFormat() {
var format = d3.time.format.multi([
[".%L", function(d) { return d.getMilliseconds(); }],
[":%S", function(d) { return d.getSeconds(); }],
["%I:%M", function(d) { return d.getMinutes(); }],
["%I %p", function(d) { return d.getHours(); }],
["%a %d", function(d) { return d.getDay() && d.getDate() != 1; }],
["%b %d", function(d) { return d.getDate() != 1; }],
["%B", function(d) { return d.getMonth(); }],
["%Y", function() { return true; }]
]);
}
Vendored
+2 -1
View File
@@ -1780,7 +1780,7 @@ declare module d3 {
export function format(specifier: string): Format;
export module format {
export function multi(formats: Array<[string, (d: Date) => boolean]>): Format;
export function multi(formats: Array<[string, (d: Date) => boolean|number]>): Format;
export function utc(specifier: string): Format;
export var iso: Format;
}
@@ -2720,6 +2720,7 @@ declare module d3 {
timeFormat: {
(specifier: string): time.Format;
utc(specifier: string): time.Format;
multi(formats: Array<[string, (d: Date) => boolean|number]>): time.Format;
}
}