Skip to content

Commit

Permalink
formatted dcpNoticeddate to reflect the offset from GMT to EST in the…
Browse files Browse the repository at this point in the history
… project js file (#1409)
  • Loading branch information
horatiorosa authored May 25, 2022
1 parent 9d68fef commit 56dee22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 9 additions & 0 deletions client/app/models/project.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import DS from 'ember-data';
import { computed } from '@ember/object';
import { sort, alias } from '@ember/object/computed';
import moment from 'moment';
import { DCP_APPLICABILITY_OPTIONSET } from './project/constants';
import {
STATUSCODE_OPTIONSET,
Expand Down Expand Up @@ -125,6 +126,14 @@ export default class ProjectModel extends Model {

@attr() dcpNoticeddate;

@computed('dcpNoticeddate')
get formattedNoticedDate() {
if (moment(this.dcpNoticeddate).isDST()) {
return moment(this.dcpNoticeddate).utcOffset(240).format('M/D/YYYY');
}
return moment(this.dcpNoticeddate).utcOffset(300).format('M/D/YYYY');
}

@computed('dcpApplicability')
get dcpApplicabilitySimp() {
const option = Object.values(DCP_APPLICABILITY_OPTIONSET).find(applicability => applicability.label === this.dcpApplicability);
Expand Down
4 changes: 1 addition & 3 deletions client/app/templates/show-project.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@
<strong>Noticed Date:</strong>
{{#if model.dcpNoticeddate}}
<DateDisplay
@date={{model.dcpNoticeddate}}
@outputFormat="M/D/YYYY"
@date={{model.formattedNoticedDate}}
/>
{{!-- {{model.dcpNoticeddate}} --}}
{{else}}
Not yet noticed
{{/if}}
Expand Down

0 comments on commit 56dee22

Please sign in to comment.