Skip to content

Feature request: additional option for timeOnly to show date, too. #633

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

Closed
JohnArcher opened this issue Sep 3, 2013 · 7 comments
Closed

Comments

@JohnArcher
Copy link

Hi there!

I am not sure whether this is already possible somehow, but I want to achieve that the input field can also show the current/default date, although set the timeOnly option to true. I guess I could also use the altField stuff, which if I understand it correctly I can split time and date into two input fields? But my projects require that I have one input fields which shows both date and time but I can only adjust the time.

I already figured out how to alter you code to achieve that but before I pull request that I want to make sure that this is ok and there is no other way to achieve that. Basically it is that (in _updateDateTime() where timeOnlyShowDate is my new option):

if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
    formattedDateTime = this.formattedTime;
} else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
    formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
}

What do you think?

Regards

@JohnArcher
Copy link
Author

Any opionions on that, @trentrichardson ? Thanks a lot!

@JohnArcher
Copy link
Author

I would be very happy and thankful, if you could comment that, @trentrichardson . Thanks!

@trentrichardson
Copy link
Owner

@JohnArcher Sorry for the delay, I completely missed this post. That probably wouldn't be a bad option to integrate in. Not sure if that would be the only place changes would need to be made, but with any luck that would cover it.

@trentrichardson
Copy link
Owner

@JohnArcher I applied your changes and it appears to work fine. It is in the dev branch.

@JohnArcher
Copy link
Author

Hey, cool, thanks a lot!

Do you think, the name of the option is ok (as English is not my native language)?

Hm, maybe another way would be to extend pickerTimeFormat or the timeformat respectively so you could also use the datepicker-mmddyy-stuff there, too? Just a quick thought, don't know, whether this is easy to implement and convenient ...

@trentrichardson
Copy link
Owner

They way you had it is probably best. I try to not do any "date" related work and leave that to datepicker. If you knew what the date was in advance you can always use the literal syntax inside the timeformat like so: "'2014-03-05' HH:mm:ss". Anything in the timeFormat inside of single quotes should be bypassed and treated as literal text. I think the option name explains what it is trying to do pretty clear, so it is good.

@JohnArcher
Copy link
Author

Ok, great, thanks a lot for the hints (I think it is good that you leave the date stuff out) and your work.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants