-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aacbc44
commit 3ebdf88
Showing
5 changed files
with
41 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import { GrowthInfo } from "./growthInfo"; | ||
import { BoxDetails } from "./boxDetails"; | ||
import { Seed } from "./seed"; | ||
import moment from 'moment' | ||
|
||
export interface BoxItem { | ||
export class BoxItem { | ||
id: string; | ||
seeds: Seed[]; | ||
growthInfo: GrowthInfo; | ||
seedsAverageInchHeight: number; | ||
germinationDay: string; | ||
dateSinceGermination: string; | ||
|
||
constructor(boxDetails: BoxDetails) { | ||
this.id = boxDetails.id.value; | ||
this.seeds = boxDetails.seeds; | ||
this.seedsAverageInchHeight = boxDetails.growthInfo.seedsAverageInchHeight; | ||
|
||
const momentGerminationDay = moment(boxDetails.growthInfo.germinationDay); | ||
const now = moment(new Date()); | ||
this.germinationDay = momentGerminationDay.format("Do MMMM YYYY"); | ||
this.dateSinceGermination = moment.duration(now.diff(momentGerminationDay)).asDays().toFixed(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters