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

add generic firestore date forge for any Enitity #40

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

brettski
Copy link
Member

@brettski brettski commented Dec 3, 2020

function entityDateForge accepts array of fields to forge and return a function to use on entity objects to forge Firestore fields to JavaScript Date types.

Includes package bumps

closes #39

@brettski brettski added the enhancement New feature or request label Dec 3, 2020
@brettski brettski self-assigned this Dec 3, 2020
@brettski brettski merged commit c134a01 into master Dec 4, 2020
@brettski brettski deleted the brettski/39/generic-forge branch December 4, 2020 14:23
@@ -12,17 +12,41 @@ function dateForge(date) {
if (date.toDate) {
// Firestore Timestamp type
result = date.toDate();
} else if (date.getTime()) {
} else if (date instanceof Date) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still true if you were using a moment or dayjs object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a generic date forge
2 participants