Source language: Translate to:

Date Picker options

General questions about NeoBook

Moderator: Neosoft Support

Date Picker options

Postby TMcD » Sat Aug 19, 2017 6:24 pm

I'll start off by stating that I think NeoBook should have a datepicker built in.

Now my next question is how to go about it on my own... (I don't want to use a 3rd party plugin, since unfortunately I don't want to rely on a 3rd party since most disappear and my app needs to remain solid.)

I'd like to use drop downs, Select Month, Day and Year. The only problem is figuring out leap year, meaning...

I don't want to just allow day selection of 1-31 because not all months have 31 days and for February, I'd need to figure if it was a leap year or not.

My app allows people to set one future specific date.

Any ideas while I go through the forum? :)

Thanks.
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: Date Picker options

Postby Gaev » Sat Aug 19, 2017 6:42 pm

TMcD:

I'd like to use drop downs, Select Month, Day and Year.

Suggest you make them part of a Custom Window ... so you can invoke with just one command.

The only problem is figuring out leap year, meaning...
I don't want to just allow day selection of 1-31 because not all months have 31 days and for February, I'd need to figure if it was a leap year or not.
Any ideas while I go through the forum? :)

Check if a particular year is a LEAP year - http://www.scriptedlogic.com/zzold/neoHOW6.htm

Suggest you make the logic a Called Function ... so you can reuse from anywhere in any number of pubs.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Date Picker options

Postby TMcD » Sat Aug 19, 2017 6:47 pm

Ok, so I didn't find anything (quickly in the forum), so I thought I could find a Javascript, and I did.

I created a JScript Function:

Code: Select all
// Get Year from NeoBook [Year]

var tempYear = nbGetVar( '[Year]' );

// Found this formula online
// Not a Leap Year Returns: False
// A Leap Year Returns: True

LeapYearVerify = (tempYear % 100 === 0) ? (tempYear % 400 === 0) : (tempYear % 4 === 0);

// Set NeoBook Variable

nbSetVar("[IsItLeapYear]", LeapYearVerify);


This takes the current year checks if it is a Leap Year and returns a True if it is, or False if it is not a leap year. The result is stored in variable [IsItLeapYear]

And Bob's your uncle. :)

* I tried to make it easy to understand so that others can try some Javascript as well. I'm not an expert, just slightly dangerous. :)
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: Date Picker options

Postby TMcD » Sat Aug 19, 2017 7:11 pm

Gaev wrote:TMcD:

I'd like to use drop downs, Select Month, Day and Year.

Suggest you make them part of a Custom Window ... so you can invoke with just one command.

The only problem is figuring out leap year, meaning...
I don't want to just allow day selection of 1-31 because not all months have 31 days and for February, I'd need to figure if it was a leap year or not.
Any ideas while I go through the forum? :)

Check if a particular year is a LEAP year - http://www.scriptedlogic.com/zzold/neoHOW6.htm

Suggest you make the logic a Called Function ... so you can reuse from anywhere in any number of pubs.

Thanks. I will make note of this too. I'm always learning with NeoBook. I also appreciate forum helpers such as yourself.
* The way you pointed to won't rely on Javascript, which is good, though relying on Javascript shouldn't be an issue (I think) :shock:
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: Date Picker options

Postby Neosoft Support » Sat Aug 19, 2017 7:49 pm

DBPro has a date picker action (dbpPopupDateSelector). It can be used for non-database applications.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Date Picker options

Postby TMcD » Mon Aug 21, 2017 11:37 am

Neosoft Support wrote:DBPro has a date picker action (dbpPopupDateSelector). It can be used for non-database applications.


And NeoBook itself should have one as well. :D
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: Date Picker options

Postby dpayer » Mon Aug 21, 2017 1:57 pm

TMcD wrote:I'll start off by stating that I think NeoBook should have a datepicker built in.

Now my next question is how to go about it on my own... (I don't want to use a 3rd party plugin, since unfortunately, I don't want to rely on a 3rd party since most disappear and my app needs to remain solid.)

Thanks.


I created a function and a template you can use as a date picker. I use it in a couple of my apps.

I have a standalone demo but you can embed just the calendar on your page. See this page:

viewtopic.php?f=22&t=20140
Image

Let me know if you need help implementing. It is all NB script an and NB objects.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1383
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: Date Picker options

Postby TMcD » Mon Aug 21, 2017 2:25 pm

dpayer wrote:
TMcD wrote:I'll start off by stating that I think NeoBook should have a datepicker built in.

Now my next question is how to go about it on my own... (I don't want to use a 3rd party plugin, since unfortunately, I don't want to rely on a 3rd party since most disappear and my app needs to remain solid.)

Thanks.


I created a function and a template you can use as a date picker. I use it in a couple of my apps.

I have a standalone demo but you can embed just the calendar on your page. See this page:

viewtopic.php?f=22&t=20140

Let me know if you need help implementing. It is all NB script an and NB objects.

Super nice. I'm gonna stick with my basic one I have created because it's not really needing to be that "pretty".. :lol: for now.

I still think there needs to be a default Date/Time picker within NeoBook. (I'll one day get around to my full request list.) :wink:
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 4 guests