@@ -745,8 +745,10 @@ export default class DateTime {
745
745
* @param {string } [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
746
746
* @param {string } opts.outputCalendar - the output calendar to set on the resulting DateTime instance
747
747
* @param {string } opts.numberingSystem - the numbering system to set on the resulting DateTime instance
748
+ * @param {DateTime|Date|Object } opts.refrenceDate - the reference date to taken for missing parts
748
749
* @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
749
750
* @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'
751
+ * @example DateTime.fromObject({ year: 1982 }, { refrenceDate: { day: 10 } }).toISODate() //=> '1982-01-10'
750
752
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06
751
753
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),
752
754
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
@@ -766,7 +768,9 @@ export default class DateTime {
766
768
const normalized = normalizeObject ( obj , normalizeUnitWithLocalWeeks ) ;
767
769
const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues ( normalized , loc ) ;
768
770
769
- const tsNow = Settings . now ( ) ,
771
+ const tsNow = isUndefined ( opts . refrenceDate )
772
+ ? friendlyDateTime ( opts . refrenceDate ) . toUnixInteger ( )
773
+ : opts . refrenceDate ,
770
774
offsetProvis = ! isUndefined ( opts . specificOffset )
771
775
? opts . specificOffset
772
776
: zoneToUse . offset ( tsNow ) ,
0 commit comments