gregorian-calendar
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -37,3 +37,3 @@ /* | ||
*/ | ||
this.time = Date.now(); | ||
this.time = undefined; | ||
/* | ||
@@ -459,9 +459,9 @@ * The timezoneOffset in minutes used by this date. | ||
computeTime: function computeTime() { | ||
if (!this.isSet(YEAR)) { | ||
throw new Error('year must be set for GregorianCalendar'); | ||
var year = undefined; | ||
var fields = this.fields; | ||
if (this.isSet(YEAR)) { | ||
year = fields[YEAR]; | ||
} else { | ||
year = new Date().getFullYear(); | ||
} | ||
var fields = this.fields; | ||
var year = fields[YEAR]; | ||
var timeOfDay = 0; | ||
@@ -477,16 +477,9 @@ if (this.isSet(HOUR_OF_DAY)) { | ||
timeOfDay += fields[MILLISECONDS] || 0; | ||
var fixedDate = 0; | ||
fields[YEAR] = year; | ||
fixedDate = fixedDate + this.getFixedDate(); | ||
// millis represents local wall-clock time in milliseconds. | ||
var millis = (fixedDate - EPOCH_OFFSET) * ONE_DAY + timeOfDay; | ||
millis -= this.timezoneOffset * ONE_MINUTE; | ||
this.time = millis; | ||
this.computeFields(); | ||
@@ -579,3 +572,3 @@ }, | ||
fixedDate += fields[DAY_OF_YEAR] - 1; | ||
} else { | ||
} else if (self.isSet(WEEK_OF_YEAR)) { | ||
firstDayOfWeek = getDayOfWeekDateOnOrBefore(fixedDate + 6, firstDayOfWeekCfg); | ||
@@ -582,0 +575,0 @@ // If we have enough days in the first week, then move |
{ | ||
"name": "gregorian-calendar", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"author": "yiminghe <yiminghe@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "date time utils ported from java", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52673
1428