DEV Community

loading...

Discussion on: Get the number of days between two dates in Go

Collapse
adamjack profile image
Adam Jack

Thanks for sharing this. I like your approach. What are your thoughts on ensuring that "a" and "b" are within the same time.Location (Timezone) as each other?

For my thinking if they are in different time zones they might be viewed as in a different YearDay than accurate for the two.

I passed in time.Location, used that instead of time.UTC (although that seems moot, except for the benefits of the simplicity of consistency) and ensured that "a" and "b" are in the same TZ.

Collapse
samwho profile image
Sam Rose Author

That sounds extremely reasonable. 🙂