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

Can i do a PR to represent dates with timezone offset? #35

Open
randallb opened this issue Jul 3, 2020 · 3 comments
Open

Can i do a PR to represent dates with timezone offset? #35

randallb opened this issue Jul 3, 2020 · 3 comments

Comments

@randallb
Copy link

randallb commented Jul 3, 2020

Hi totally new to this project... love it btw!

Question: Are you interested in a PR to add timezone relative dates to the library?

ie

const thingy = {
date: new Date(),
};
TOML.stringify(thingy);

// date = 2020-07-03T22:21:32.426Z

I'd like to make it more human editable for my people using the product, so is it possible / plausible to change the stringified date into the user's local timezone?

date = 2020-07-03T21:21:32.426-01:00

Looks like I'd do this in stringify.js

How many bytes would you allow me to add? Should I do this in some sort of external way so you can turn it on and off? Should it be the default behavior?

@randallb randallb changed the title Representing dates with timezone offset? Can i do a PR to represent dates with timezone offset? Jul 3, 2020
@iarna
Copy link
Owner

iarna commented Jul 5, 2020

That seems pretty reasonable to me. I'd prefer to avoid config options: Let's go with it as the new default.

One special note: If the date is currently UTC, then let's not change the current representation. Eg, continue to use the Z shortcut.

Uh, what do you mean by "how many bytes would you allow me to add"? =D

@randallb
Copy link
Author

randallb commented Jul 9, 2020

@iarna I work at FB... bytesize is a big deal to some ppl 😄 . I'll probably knock this out over the weekend.

@randallb
Copy link
Author

latest...randallb:working#diff-c3fcfbed30e93682746088e2ce1a4a24R244-R257

I got it working, but tests aren't passing. I'll need to make the tests more resilient to this style of datestamp.

Will probably keep going, but might not. :) If someone really wants it, i'll do it, but i'm going to punt on this for my project right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants