Skip to content

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

Closed
@JohnArcher

Description

@JohnArcher

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions