Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnab Sen
LaMartin-Webomagic
Commits
b57f1d23
Commit
b57f1d23
authored
Jul 01, 2024
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add a test file for date picker
parent
432b8c71
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
lamartinFrontend/datepickerForm.html
lamartinFrontend/datepickerForm.html
+46
-0
No files found.
lamartinFrontend/datepickerForm.html
0 → 100644
View file @
b57f1d23
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Datetime Picker
</title>
<script
src=
"https://code.jquery.com/jquery-3.6.0.min.js"
></script>
</head>
<body>
<input
type=
"date"
id=
"datePicker"
>
<input
type=
"time"
id=
"timePicker"
>
<button
id=
"logDatetime"
>
Log Datetime
</button>
<div
id=
"result"
></div>
<script>
function
formatAMPM
(
date
)
{
var
hours
=
date
.
getHours
();
var
minutes
=
date
.
getMinutes
();
var
ampm
=
hours
>=
12
?
'
PM
'
:
'
AM
'
;
hours
=
hours
%
12
;
hours
=
hours
?
hours
:
12
;
// the hour '0' should be '12'
minutes
=
minutes
<
10
?
'
0
'
+
minutes
:
minutes
;
var
strTime
=
hours
+
'
:
'
+
minutes
+
'
'
+
ampm
;
return
strTime
;
}
$
(
document
).
ready
(
function
()
{
$
(
'
#logDatetime
'
).
click
(
function
()
{
var
date
=
$
(
'
#datePicker
'
).
val
();
var
time
=
$
(
'
#timePicker
'
).
val
();
if
(
!
date
||
!
time
)
{
alert
(
'
Please select both date and time.
'
);
return
;
}
var
selectedDateTime
=
new
Date
(
date
+
'
T
'
+
time
);
var
formattedDateTime
=
date
+
'
T
'
+
formatAMPM
(
selectedDateTime
);
//TODO: send date and formatAMPM(selectedDateTime) to the backend
$
(
'
#result
'
).
text
(
formatAMPM
(
selectedDateTime
));
console
.
log
(
formattedDateTime
);
});
});
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment