fix a scale bar UTC off-by-one error
This commit is contained in:
parent
06f27b75bd
commit
c3b4d40903
1 changed files with 9 additions and 16 deletions
|
@ -85,9 +85,7 @@ Ox.Calendar = function(options, self) {
|
|||
id: 'millennium',
|
||||
seconds: 365242.5 * 86400,
|
||||
date: function(i) {
|
||||
var date = new Date(1970, 0, 1);
|
||||
date.setUTCFullYear((i + 1) * 1000);
|
||||
return date;
|
||||
return new Date(Date.UTC((i + 1) * 1000, 0, 1))
|
||||
},
|
||||
name: function(i) {
|
||||
return i > -2
|
||||
|
@ -102,9 +100,7 @@ Ox.Calendar = function(options, self) {
|
|||
id: 'century',
|
||||
seconds: 36524.25 * 86400,
|
||||
date: function(i) {
|
||||
var date = new Date(1970, 0, 1);
|
||||
date.setUTCFullYear((i + 19) * 100);
|
||||
return date;
|
||||
return new Date(Date.UTC((i + 19) * 100, 0, 1))
|
||||
},
|
||||
name: function(i) {
|
||||
return i > -20
|
||||
|
@ -119,9 +115,7 @@ Ox.Calendar = function(options, self) {
|
|||
id: 'decade',
|
||||
seconds: 3652.425 * 86400,
|
||||
date: function(i) {
|
||||
var date = new Date(1970, 0, 1);
|
||||
date.setUTCFullYear((i + 197) * 10);
|
||||
return date;
|
||||
return new Date(Date.UTC((i + 197) * 10, 0, 1))
|
||||
},
|
||||
name: function(i) {
|
||||
return (i + 197) + '0s'
|
||||
|
@ -134,7 +128,7 @@ Ox.Calendar = function(options, self) {
|
|||
id: 'year',
|
||||
seconds: 365.2425 * 86400,
|
||||
date: function(i) {
|
||||
return '01/01/' + (i + 1970) + ' UTC';
|
||||
return new Date(Date.UTC(i + 1970, 0, 1));
|
||||
},
|
||||
name: function(i) {
|
||||
return (i + 1970) + '';
|
||||
|
@ -147,9 +141,7 @@ Ox.Calendar = function(options, self) {
|
|||
id: 'month',
|
||||
seconds: 365.2425 / 12 * 86400,
|
||||
date: function(i) {
|
||||
var date = new Date(1970, Ox.mod(i, 12), 1);
|
||||
date.setUTCFullYear(Math.floor(i / 12) + 1970)
|
||||
return date;
|
||||
return new Date(Date.UTC(Math.floor(i / 12) + 1970, Ox.mod(i, 12), 1));
|
||||
},
|
||||
name: function(i) {
|
||||
return Ox.SHORT_MONTHS[Ox.mod(i, 12)] + ' ' + Math.floor(i / 12 + 1970)
|
||||
|
@ -566,7 +558,7 @@ Ox.Calendar = function(options, self) {
|
|||
var left = Math.max(getPosition(event.start, zoom), -10000),
|
||||
paddingLeft = (event.type && left < 0 ? -left : 0),
|
||||
width = Ox.limit(getPosition(event.end, zoom) - left, 1, 20000) - paddingLeft;
|
||||
//Ox.print('LEFT', left, 'WIDTH', width)
|
||||
Ox.print('LEFT', left, 'WIDTH', width, 'P-LEFT', paddingLeft)
|
||||
return new Ox.Element()
|
||||
.addClass('OxEvent' +
|
||||
(event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) +
|
||||
|
@ -672,7 +664,8 @@ Ox.Calendar = function(options, self) {
|
|||
value = unit.value(self.options.date),
|
||||
width = unit.seconds * getPixelsPerSecond(zoom),
|
||||
n = Math.ceil(self.options.width * 1.5/* * 16*/ / width);
|
||||
Ox.print(zoom, getUnits(zoom).map(function(u) {return u.name(value)}).join('/'))
|
||||
//Ox.print(zoom, getUnits(zoom).map(function(u) {return u.name(value)}).join('/'))
|
||||
Ox.print('VALUE', value)
|
||||
Ox.loop(-n, n + 1, function(i) {
|
||||
$elements.push(
|
||||
getEventElement({
|
||||
|
@ -717,7 +710,7 @@ Ox.Calendar = function(options, self) {
|
|||
title = '<span class="OxBright">' + event.name + '</span><br/>' +
|
||||
formatEvent(event);
|
||||
} else {
|
||||
title = Ox.formatDate(getMouseDate(e), '%a, %b %e, %Y, %H:%M:%S');
|
||||
title = Ox.formatDate(getMouseDate(e), '%a, %b %e, %Y, %H:%M:%S', true);
|
||||
}
|
||||
self.$tooltip.options({
|
||||
title: title
|
||||
|
|
Loading…
Reference in a new issue