bendrucker / postgres-interval

Parse Postgres interval columns
MIT License
33 stars 19 forks source link

Add short option to PostgresInterval#toISOString #31

Closed odub closed 4 years ago

odub commented 4 years ago

Closes #30

bendrucker commented 4 years ago

Thanks! Going from an object to text and back is a bit awkward. There's a lot baked into that regex and presumably a perf hit.

I'd rather see the main toISOString method become a separate function that takes a { short = false} argument. Then the existing method can become return toISOString() and your new method can be return toISOString({short: true}).

odub commented 4 years ago

@bendrucker Just fixed those comments. Agreed that that's a nicer API

bendrucker commented 4 years ago

Thanks for following up. What I had in mind there was using an option internally, but keeping the API the same. Partially for strict semver, partially to match the Date.prototype.toISOString signature. Went ahead and revised that, will merge and release now.

odub commented 4 years ago

Looking forward to using this! Cheers!

bendrucker commented 4 years ago

Published as 2.1.0