-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(time): Convert Date into DateValue for intervals
- Loading branch information
1 parent
78cbdca
commit bee75e6
Showing
2 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import DateValue from './date-value'; | ||
|
||
/** | ||
* Convert a date into an object usable in the exported values. | ||
*/ | ||
export default function fromDate(date) { | ||
const result = new DateValue(); | ||
result.year = date.getFullYear(); | ||
result.month = date.getMonth(); | ||
result.day = date.getDate(); | ||
result.hour = date.getHours(); | ||
result.minute = date.getMinutes(); | ||
result.second = date.getSeconds(); | ||
return result; | ||
} |
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