Giter VIP home page Giter VIP logo

Comments (8)

Lataoodles avatar Lataoodles commented on July 28, 2024 5

@Istiak1992
You can use this method
$("#timepicker1").on('click',function(){
alert("Hi")
})

from timepicki.

diegoburgio avatar diegoburgio commented on July 28, 2024

Hello, I'm not senthilraj and some months lasted since you posted the answer, but I also wanted to use custom divider and I found a solution.
Option is format_output and it accepts a function like that:

function(tim, mini, meri) {
                if(settings.show_meridian){
                    return tim + " : " + mini + " : " + meri;
                }else{
                    return tim + " : " + mini;
                }
            }

This is default one, you can find it at top of plugin source js. However, in that contest we don't have settings variable, so if you don't need the spaces and want 24h format, like me, you can modify it in this way:

function(tim, mini, meri) {
                return tim + ":" + mini;
        }

Hope it helps you or any lurker!

from timepicki.

jonasferagen avatar jonasferagen commented on July 28, 2024

Hi, and thanks for a great plugin!

I had the exact same problem and made a hack for a format_string option (syntax like strftime)
https://github.com/chroz/TimePicki
i - i.e. the current default is %H : %M : %p,
i override this in my pickers with "%H:%M"

It's way too hackish to be worthy of a pull request, but I think something like this could be the way to go, maybe making the show_meridian option implicit in the future?

from timepicki.

seleckis avatar seleckis commented on July 28, 2024

Thank you for your replies, guys, but these hacks do not resolve the issue. I need to set default value from backend. Using your solution, I have to generate JS code right in the HTML, or load it via AJAX. It is nightmare. I have already moved to https://eonasdan.github.io/bootstrap-datetimepicker/, which solves this problem, but unfortunately it needs bootstrap.

from timepicki.

cefrigo avatar cefrigo commented on July 28, 2024

I made this it works fine...

function getTimepickiTime(obj) {
    var TimeValue = obj.val();
    var trimmedTimeValue = TimeValue.replace(/ /g,'');
    var resultSplit = trimmedTimeValue.split(':');
    return resultSplit;
};
   $('.timepicker_start').timepicki({
         start_time: getTimepickiTime($('.timepicker_start'))
     });

This will take the value of the input and use it as default

from timepicki.

repler avatar repler commented on July 28, 2024

I know this thread is kind of old, but you can set the default value through HTML by specifying the following attributes on your input tag:

data-timepicki-tim
data-timepicki-mini
data-timepicki-meri

For hours, minutes, and meridian, respectively.
Works just fine without any code changes.

from timepicki.

Istiak1992 avatar Istiak1992 commented on July 28, 2024

i want to pop up an alert when i change time when value is changed in the textbox i want an alert pop up.how can i accomplish this?

from timepicki.

jaimestuardo avatar jaimestuardo commented on July 28, 2024

I have fixed it by changing code in line 407 of timepicki.js to this:

		var value = ele[0].value.replace(/ /g, '');
		if (value.length === 0) {
			d = new Date();
			ti = d.getHours();
			mi = d.getMinutes();
		}
		else {
			ti = parseInt(value.substr(0, 2));
			mi = parseInt(value.substr(3, 2));
                    }

Regards
Jaime

from timepicki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.