Hello all,
I am trying to create a schedule based off one input field, I want to put in "text/time box 1" a time and time "text/time box 2" will automatically add 25 minutes to that etc...
I am using 24 hour format ( I can switch but assume its easier that way.) and I will not be crossing the days,
Thank you in advance for any help on this.
Views
Replies
Total Likes
Any Ideas?
Views
Replies
Total Likes
Working solution by me (tested):
var oCurrentDate = new Date (this.rawValue.replace("-", " ", "g"));
var CurrYear = oCurrentDate.getFullYear(); // get 4 digit year number
var CurrMonth = oCurrentDate.getMonth() + 1; // get current month number
var CurrDay = oCurrentDate.getDate();
if (CurrMonth.toString().length<2) {CurrMonth = '0' + CurrMonth;}
if (CurrDay.toString().length<2) {CurrDay = '0' + CurrDay;}
xfa.resolveNode("DateField1[1]").formattedValue = CurrDay + "/" + CurrMonth + "/" + CurrYear;
code under DateField1[0] exit event
Both date fields have this pattern: date{DD/MM/YYYY}
in
Validation Pattern... | Edit tab | Display tab | Validation tab
You should adapt it from date to time.
Views
Replies
Total Likes
This is more focused on your needs:
var StartTime = this.rawValue.split(":");
var oCurrentDate = new Date();
oCurrentDate.setHours(StartTime[0]);
oCurrentDate.setMinutes(StartTime[1]);
var CurrHours = oCurrentDate.getHours(); // get 4 digit year number
var enlapse = 5;
var CurrMin = oCurrentDate.getMinutes() + enlapse; // get current month number
if (CurrMin + enlapse > 60) {CurrHours++; CurrMin = CurrMin - 60;}
if (CurrMin.toString().length<2) {CurrMin= '0' + CurrMin;}
if (CurrHours.toString().length<2) {CurrHours = '0' + CurrHours;}
xfa.resolveNode("TimeField2").formattedValue = CurrHours + ":" + CurrMin;
2 time fields
code under TimeField1 exit event
Both time fields have this pattern: time{HH:MM}
in
Validation Pattern... | Edit tab | Display tab | Validation tab
Set enlapse var to your needs.
You'll probably have to add more checkpoints to handle wrong time format inputs in TimeField1.
Views
Replies
Total Likes
mrfale67,
Thank you for your help, I'll give it a shot.
Views
Replies
Total Likes