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

Preset Issue: Pulling in current date/time unexpectedly #9

Closed
mmccallum opened this issue Jan 25, 2017 · 9 comments
Closed

Preset Issue: Pulling in current date/time unexpectedly #9

mmccallum opened this issue Jan 25, 2017 · 9 comments
Labels

Comments

@mmccallum
Copy link

Hi,
Great little component. I'm liking it so far.

Seem to be having an issue where presets are picking up the wrong date. I would expect that when using a preset, to be able to set the start date and end date, but when setting the start using moment and adding an amount of time to the end, the component gets updated with the current date/time. Of course, I could be doing something wrong. I've created a fiddle example: https://jsfiddle.net/rtzmxLgL/6/

Please let me know if I am using something wrong, because that is entirely possible.

Thanks!
M

@g1eb
Copy link
Owner

g1eb commented Jan 26, 2017

Thanks! I'm glad you like it :)

If I understand correctly you would like to keep current start/end datetime objects when using presets. That is to say, selecting a preset would update the time but not the date. Is that right?

If that is the case you just need to update your array of presets in your setDate method.
See this fiddle for an example.

@mmccallum
Copy link
Author

Close. What I would like to see is this:

  1. Select a start date and time.
  2. Open presets, select the length of time ( 15 minutes, 30 minutes, 1 hour, etc)
    The result should be that the start date stays the same and the end date has the preset applied to it to,

Does that make it clear? Your example fiddle still resets the start date.

-M

@g1eb
Copy link
Owner

g1eb commented Jan 26, 2017

Ahh, gotcha, you select start date and time manually (I was thrown off by "click on set date and then select preset" instruction in your fiddle).

I've updated the fiddle to match described behavior.

@mmccallum
Copy link
Author

Getting closer. :)
The set date was just to simulate getting an existing date from an external source.

Your example does seem to currently work if you use the set date button, but if you select a start date/time, click the close button at the bottom, the preset options disappear. A couple of times I could get them back but both dates would get clobbered if I could use them.

-M

@g1eb
Copy link
Owner

g1eb commented Jan 26, 2017

Haha, we are getting there :)

In any case, you have a well defined flow, users enter start date and time then proceed to select a preset range of time. All you need to do is update presets right?

(close button has a different callback, updated fiddle)

@g1eb g1eb added the question label Feb 3, 2017
@g1eb
Copy link
Owner

g1eb commented Feb 3, 2017

Hi, how are you doing?

Just wanted to check in to see if you got this working or if you need my help :)

@mmccallum
Copy link
Author

mmccallum commented Feb 3, 2017 via email

@g1eb
Copy link
Owner

g1eb commented Feb 4, 2017

Of course, take your time! Let me know if you need my help with it :)

@g1eb
Copy link
Owner

g1eb commented Mar 11, 2017

Closing due to prolonged period of inactivity

@g1eb g1eb closed this as completed Mar 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants