Skip to content

Commit

Permalink
Fixed issue with incorrect specificity and missing params values (and…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewplummer committed Aug 21, 2018
1 parent d9d7b28 commit cbbdbba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ function simpleClone(obj) {
return simpleMerge({}, obj);
}

// TODO: Use Object.assign here going forward.
function simpleMerge(target, source) {
forEachProperty(source, function(val, key) {
target[key] = val;
Expand Down
2 changes: 1 addition & 1 deletion lib/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ function getExtendedDate(contextDate, d, opt, forceClone) {
afterDateSet(function() {
updateDate(date, params, true, 0, false, weekdayDir);
if (optParams) {
optParams.specificity = params.specificity;
simpleMerge(optParams, params);
}
});
if (set.edge) {
Expand Down
8 changes: 8 additions & 0 deletions test/tests/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ namespace('Date', function () {
// Issue #582 "now" with "fromUTC"
assertDateParsed('now', { fromUTC: true }, new Date(), 'now with fromUTC');

// Issue #569 Incorrect specificity and missing time
var params = {};
testCreateDate('yesterday at 2:30pm', { params: params });
equal(params.hour, 14);
equal(params.minute, 30);
equal(params.day, -1);
equal(params.specificity, 2);

});

group('Create | Simple', function() {
Expand Down

0 comments on commit cbbdbba

Please sign in to comment.