add %x option (show BC/AD if year < 1000) to formatDate, and use on mousemove
This commit is contained in:
parent
f0052d3e3c
commit
bd0f1e1ae3
2 changed files with 10 additions and 4 deletions
|
@ -701,7 +701,7 @@ Ox.Calendar = function(options, self) {
|
|||
title = '<span class="OxBright">' + event.name + '</span><br/>' +
|
||||
event.rangeText + '<br>' + event.durationText;
|
||||
} else {
|
||||
title = Ox.formatDate(getMouseDate(e), '%a, %b %e, %Y, %H:%M:%S', true);
|
||||
title = Ox.formatDate(getMouseDate(e), '%a, %b %e, %x, %H:%M:%S', true);
|
||||
}
|
||||
self.$tooltip.options({
|
||||
title: title
|
||||
|
|
12
source/Ox.js
12
source/Ox.js
|
@ -2114,7 +2114,7 @@ Ox.formatDate <f> Formats a date according to a format string
|
|||
See
|
||||
<a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strftime.3.html">strftime</a>
|
||||
and <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a>.
|
||||
'%Q' (quarter) and '%X' (year with 'BC'/'AD') are non-standard
|
||||
'%Q' (quarter) and '%X'/'%x' (year with 'BC'/'AD') are non-standard
|
||||
<script>
|
||||
Ox.test.date = new Date('2005-01-02 00:03:04');
|
||||
</script>
|
||||
|
@ -2190,6 +2190,8 @@ Ox.formatDate <f> Formats a date according to a format string
|
|||
'0'
|
||||
> Ox.formatDate(Ox.test.date, '%X') // Full year with BC or AD
|
||||
'2005 AD'
|
||||
> Ox.formatDate(Ox.test.date, '%x') // Full year with BC or AD if year < 1000
|
||||
'2005'
|
||||
> Ox.formatDate(Ox.test.date, '%Y') // Full year
|
||||
'2005'
|
||||
> Ox.formatDate(Ox.test.date, '%y') // Abbreviated year
|
||||
|
@ -2247,8 +2249,12 @@ Ox.formatDate = function(date, str, utc) {
|
|||
}],
|
||||
['w', function(d) {return Ox.getDay(d, utc);}],
|
||||
['X', function(d) {
|
||||
var y = Ox.getFullYear(d, utc);
|
||||
return Math.abs(y) + ' ' + Ox.BCAD[y < 0 ? 0 : 1];
|
||||
var y = Ox.getFullYear(d, utc);
|
||||
return Math.abs(y) + ' ' + Ox.BCAD[y < 0 ? 0 : 1];
|
||||
}],
|
||||
['x', function(d) {
|
||||
var y = Ox.getFullYear(d, utc);
|
||||
return Math.abs(y) + (y < 1000 ? ' ' + Ox.BCAD[y < 0 ? 0 : 1] : '');
|
||||
}],
|
||||
['Y', function(d) {return Ox.getFullYear(d, utc);}],
|
||||
['y', function(d) {return Ox.getFullYear(d, utc).toString().substr(-2);}],
|
||||
|
|
Loading…
Reference in a new issue