Skip to content

Comment on Fix date-handling bug when today’s date is later than the target monthparent

Comments

Better yet, in this particular case, don't use the builder pattern, and instead just provide a sensible set of constructors with appropriate defaults for unspecified arguments (e.g., 00:00 for unspecified time).

For a simple date/time class, the builder pattern reeks of pointless overengineering.

Oh certainly, didn't mean to imply it's great for a freaking date.

But I've seen the mutating pattern in other cases causing the weird state bug which could have avoided using a builder.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.