Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Normalize head date (server: Date, client: string) #397

Closed
MoOx opened this issue Apr 15, 2016 · 9 comments
Closed

Normalize head date (server: Date, client: string) #397

MoOx opened this issue Apr 15, 2016 · 9 comments
Assignees

Comments

@MoOx
Copy link
Owner

MoOx commented Apr 15, 2016

Following #395

gray-matter transform date field to Date. But on client side, we have raw json, so string. We should normalize that somewhere. Maybe after gray-matter call.

@MoOx MoOx added the bug label Apr 15, 2016
@thangngoc89
Copy link
Contributor

Looks like this is a YAML feature see https://github.com/nodeca/js-yaml#supported-yaml-types.

@MoOx
Copy link
Owner Author

MoOx commented Apr 15, 2016

So maybe we should normalize in the emitted collection on the client side.

@thangngoc89
Copy link
Contributor

I think normalize everything to string is better. Less code on client size. And less magic. I don't want user to ask us about what's going on

@thangngoc89
Copy link
Contributor

Using JSON.parse and JSON.stringify should be the easiest (and probably fastest) way to fix this. But this might impact the loader's performance. Will open another issue about this.

@MoOx MoOx self-assigned this Apr 28, 2016
@MoOx MoOx added the wip label Apr 28, 2016
@MoOx
Copy link
Owner Author

MoOx commented Apr 29, 2016

FYI yahoo/serialize-javascript#16

I successfully used my PR but this works for collection only: pages are JSON. I AM SO FUCKIN STUPID.

Blocked by #434 for a full resolution, meanwhile I will force dates to be ISOString on node, but JS with dates is kind of ready.

@MoOx MoOx added blocked and removed wip labels Apr 29, 2016
MoOx added a commit that referenced this issue Apr 29, 2016
@bloodyowl
Copy link
Contributor

Going to be fixed with #925

@MoOx
Copy link
Owner Author

MoOx commented Dec 23, 2016

What is your plan for this?

@bloodyowl
Copy link
Contributor

everything as a string, and we dont care about the format as long as it's parsable by Date in order to sort posts

@MoOx
Copy link
Owner Author

MoOx commented Mar 15, 2018

Not a problem with v1

@MoOx MoOx closed this as completed Mar 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants