@blueprintjs/datetime 1.25.4
Chrome Version 65.0.3325.181 (Official Build) (64-bit)
OSX 10.13.4 (17E199)
I don't know if this is behavior that you intend on keeping, but this sounds like something that could be controlled via a prop, and if that prop exists, I'm not seeing it in the documentation. It doesn't make sense to me to change the date that was selected using the month navigator by default.
@rclai this behavior is by design and works fine for us but we'll happily accept a PR to add such a prop.
@rclai the onChange event has a secondary argument,
onChange: (selectedDate: Date, hasUserManuallySelectedDate: boolean) => void
hasUserManuallySelectedDate is false when date changes by navigation which allows you to control the update.
Very good to know, thanks. Is this available in v1?
@mcaneris DatePicker has such secondary param, but DateInput does not, somehow the param is lost in between making it impossible to react to it when using the DateInput :(
Adding it here on this line should help: https://github.com/palantir/blueprint/blob/e53d5d4c266d8a00c03c2b4079debee91e8337d1/packages/datetime/src/dateInput.tsx#L297
@westrem would you like to submit a PR for this?
Could someone clarify the design? It seems strange to get onChange event since nothing was changed, except some internal state of the control. (the day selection box stays 'in the previous month') If the goal is to track user changing the month, wouldn't it make more sense to make a separate event?
@0xorial it looks like this issue was closed a long time ago with the resolution that you have a secondary argument in the onChange callback which helps you discriminate between the two scenarios. This is basically the same as having two events. Does this address your use case?
@adidahiya the second argument is certainly an acceptable workaround. it's just otherwise the API of the library is VERY good and intuitive and this one comes as a surprise.
@0xorial fair enough, thanks for the feedback. I would consider a PR to refactor this API to be more intuitive, probably as a breaking change for v4.x
Most helpful comment
@rclai the onChange event has a secondary argument,
onChange: (selectedDate: Date, hasUserManuallySelectedDate: boolean) => voidhasUserManuallySelectedDate is false when date changes by navigation which allows you to control the update.