Skip to content

Commit

Permalink
DAT-885 date in mds table fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asmajicbecon committed Jun 20, 2024
1 parent b0958a0 commit 3abab56
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import * as moment from 'moment';

import { Component, Input, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';

Expand Down Expand Up @@ -587,8 +585,13 @@ export class MultiDataSectionComponent extends BaseSectionComponent implements O
switch (fieldType) {
case "date": {
if(newValues[fieldID]) {
const defaultDate = moment.utc(newValues[fieldID]);
return defaultDate.isValid() ? moment.tz(defaultDate, "UTC").format("YYYY-MM-DD") : newValues[fieldID];
const newDate = new Date(newValues[fieldID]["$date"]);

const year = newDate.getFullYear();
const month = (newDate.getMonth() + 1).toString().padStart(2, '0');
const day = newDate.getDate().toString().padStart(2, '0');

return `${year}-${month}-${day}`;
}
break;
}
Expand Down

0 comments on commit 3abab56

Please sign in to comment.