Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Graduation date question and saving questions validation #842

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/scripts/directives/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ angular
$scope.updateTimeStamp = function (timestamp) {
//For Graduation date question, set the day to 1. The API needs the day but that could change in the future.
timestamp = $scope.monthYearOnly
? moment(new Date(timestamp)).set('date', 1)
? moment(new Date(timestamp)).set('date', 10)
wrandall22 marked this conversation as resolved.
Show resolved Hide resolved
: timestamp;
$scope.$apply(function () {
let dateSaveFormat = $scope.monthYearOnly
Expand All @@ -30,12 +30,13 @@ angular
},
link: function (scope, element) {
var datePickerElement = angular.element(element).find('.datepicker');
var initialDate =
scope.localModel =
scope.localModel && scope.monthYearOnly
? scope.localModel
? moment(new Date(scope.localModel)).format('YYYY-MM-DD')
: scope.localModel
? moment(new Date(scope.localModel)).format('MM/DD/YYYY hh:mm A')
: null;
var initialDate = scope.localModel ? scope.localModel : null;
caleballdrin marked this conversation as resolved.
Show resolved Hide resolved
scope.dateOptions = scope.monthYearOnly
? {
viewMode: 'years',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/directives/datepicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Directive: datepicker', function () {
it('Sets the date to the correct format based on the type of date question', function () {
scope.updateTimeStamp(new Date('02/05/1994'));

expect(scope.localModel).toBe('1994-02-01');
expect(scope.localModel).toBe('1994-02-10');

scope.monthYearOnly = false;

Expand Down
Loading