FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
angular-date-range/angular-date-range.min.js at master · DevLab2425/angular-date-range · GitHub
DevLab2425
/
angular-date-range
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
angular-date-range
/
angular-date-range.min.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
1 lines (1 loc) · 980 Bytes
Breadcrumbs
angular-date-range
/
angular-date-range.min.js
Copy path
File metadata and controls
1 lines (1 loc) · 980 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
var
DateRange
=
angular
.
module
(
"date-range"
,
[
]
)
;
DateRange
.
directive
(
"dateRange"
,
[
"$filter"
,
function
(
$filter
)
{
return
{
scope
:
{
startDate
:
"@"
,
endDate
:
"@"
}
,
template
:
'<span class="range">{{range}}</span>'
,
restrict
:
"AE"
,
replace
:
!
1
,
link
:
function
(
$scope
,
iElm
,
iAttrs
)
{
iAttrs
.
startDate
||
(
iAttrs
.
startDate
=
"January 1, 1970"
)
,
iAttrs
.
endDate
||
(
iAttrs
.
endDate
=
"January 31, 1970"
)
;
var
output
=
""
,
monthsOfYear
=
[
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
]
,
fromDate
=
new
Date
(
iAttrs
.
startDate
)
,
endDate
=
new
Date
(
iAttrs
.
endDate
)
,
from
=
{
month
:
monthsOfYear
[
fromDate
.
getMonth
(
)
]
,
day
:
fromDate
.
getDate
(
)
,
year
:
fromDate
.
getFullYear
(
)
}
,
end
=
{
month
:
monthsOfYear
[
endDate
.
getMonth
(
)
]
,
day
:
endDate
.
getDate
(
)
,
year
:
endDate
.
getFullYear
(
)
}
;
output
=
from
.
month
===
end
.
month
?
$filter
(
"date"
)
(
fromDate
,
"MMMM d"
)
+
" - "
+
$filter
(
"date"
)
(
endDate
,
"d, yyyy"
)
:
$filter
(
"date"
)
(
fromDate
,
"MMMM d, yyyy"
)
+
" - "
+
$filter
(
"date"
)
(
endDate
,
"MMMM d, yyyy"
)
,
$scope
.
range
=
output
}
}
}
]
)
;
Back
|
FazBrowse Home
|
New Git URL