I don't need dates to hold seconds or milliseconds.
Please note that the Gregorian calendar moves in cycles of 400 years, therefore, in cycles of 240,000 years. Therefore, you can take the 60,000 millisecond Date representation that you do not want to use to return to cycles of 240,000 years (up to 60,000 such cycles). This could take about 14.4 billion BC. E. (just before Big Bang :)), with minimal resolution.
The following example does not take into account all the functionality of the Date object. However, with further implementation, I believe it is possible to have similar functionality. For example, one BigDate, x , is larger than the other BigDate, y , if both dates are AC and x.original > y.original or if x.isAC() , but !y.isAC() , or if both BC dates are such that either x.getFullYear() < y.getFullYear() , or x.getFullYear() === y.getFullYear() && x.original > y.original .
Using BigDate:
var time = new Date ( [year ], [month ], [day of month ], [hours ], [minutes ], [a factor of 240,000,000 years to go back (from the first parameter year) ], [a factor of 240,000 years to go back (from the first parameter year) ]); var bigDate = new BigDate(time);
HTML
<span id="years"></span> <span id="months"></span> <span id="date"></span> <span id="hours"></span> <span id="minutes"></span> <span id="acbc"></span>
JAVASCRIPT
function BigDate (date) { this.original = date; } // set unchanged methods, BigDate.prototype.getMinutes = function () { return this.original.getMinutes(); } BigDate.prototype.getHours = function () { return this.original.getHours(); } BigDate.prototype.getDate = function () { return this.original.getDate(); } BigDate.prototype.getMonth = function () { return this.original.getMonth(); } // implement other BigDate methods..
And here comes the meat:
// now return non-negative year BigDate.prototype.getFullYear = function () { var ms = this.original.getSeconds() * 1000 + this.original.getMilliseconds(); if (ms === 0) return this.original.getFullYear(); else return (ms * 240000) - this.original.getFullYear(); } // now add AC/BC method BigDate.prototype.isAC = function () { var result = this.original.getSeconds() === 0 && this.original.getMilliseconds() === 0; return result; }
Some demo (can also be used to create BigDate.prototype.toString() , etc.):
var years = document.getElementById("years"); var months = document.getElementById("months"); var date = document.getElementById("date"); var hours = document.getElementById("hours"); var minutes = document.getElementById("minutes"); var acbc = document.getElementById("acbc"); // SET A TIME AND PRESENT IT var time = new Date (2016, 1, 28, 8, 21, 20, 200); var bigDate = new BigDate(time); var monthsName = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; years.innerHTML = bigDate.getFullYear(); months.innerHTML = monthsName[bigDate.getMonth()]; date.innerHTML = bigDate.getDate(); hours.innerHTML = bigDate.getHours() + ":"; minutes.innerHTML = bigDate.getMinutes(); acbc.innerHTML = (bigDate.isAC()) ? "AC":"BC";
The content 4847996014 Jan 28 8: 21 BC will be: 4847996014 Jan 28 8: 21 BC
Here's the JSFiddle .
Explanation
As for the (reasonable) design comments, I know that the BigDate object presented above demonstrates poor interface and design. An object is provided as an example for using unused seconds and milliseconds information to satisfy a question. Hope this example helps to understand the technique.