Skip to content

Commit 8e568e6

Browse files
committed
Rename tsNow --> tsRef
Fixed isUndefined usage
1 parent b655ae7 commit 8e568e6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/datetime.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ function normalizeUnitWithLocalWeeks(unit) {
387387
// single timestamp for all zones to make things a bit more predictable.
388388
//
389389
// This is safe for quickDT (used by local() and utc()) because we don't fill in
390-
// higher-order units from tsNow (as we do in fromObject, this requires that
391-
// offset is calculated from tsNow).
390+
// higher-order units from tsRef (as we do in fromObject, this requires that
391+
// offset is calculated from tsRef).
392392
function guessOffsetForZone(zone) {
393393
if (!zoneOffsetGuessCache[zone]) {
394394
if (zoneOffsetTs === undefined) {
@@ -768,12 +768,12 @@ export default class DateTime {
768768
const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
769769
const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);
770770

771-
const tsNow = isUndefined(opts.referenceDate)
772-
? friendlyDateTime(opts.referenceDate).toUnixInteger()
773-
: opts.referenceDate,
771+
const tsRef = isUndefined(opts.referenceDate)
772+
? Settings.now()
773+
: friendlyDateTime(opts.referenceDate).toUnixInteger(),
774774
offsetProvis = !isUndefined(opts.specificOffset)
775775
? opts.specificOffset
776-
: zoneToUse.offset(tsNow),
776+
: zoneToUse.offset(tsRef),
777777
containsOrdinal = !isUndefined(normalized.ordinal),
778778
containsGregorYear = !isUndefined(normalized.year),
779779
containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
@@ -801,7 +801,7 @@ export default class DateTime {
801801
// configure ourselves to deal with gregorian dates or week stuff
802802
let units,
803803
defaultValues,
804-
objNow = tsToObj(tsNow, offsetProvis);
804+
objNow = tsToObj(tsRef, offsetProvis);
805805
if (useWeekData) {
806806
units = orderedWeekUnits;
807807
defaultValues = defaultWeekUnitValues;

0 commit comments

Comments
 (0)