Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
d41a1005
Kaydet (Commit)
d41a1005
authored
Mar 26, 2019
tarafından
Nick Pope
Kaydeden (comit)
Tim Graham
Mar 27, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed unused timeparse.js.
Unused since its introduction in
dd5320d1
.
üst
f0f3b302
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
141 deletions
+0
-141
timeparse.js
django/contrib/admin/static/admin/js/timeparse.js
+0
-106
timeparse.test.js
js_tests/admin/timeparse.test.js
+0
-32
tests.html
js_tests/tests.html
+0
-3
No files found.
django/contrib/admin/static/admin/js/timeparse.js
deleted
100644 → 0
Dosyayı görüntüle @
f0f3b302
(
function
()
{
'use strict'
;
var
timeParsePatterns
=
[
// 9
{
re
:
/^
\d{1,2}
$/i
,
handler
:
function
(
bits
)
{
if
(
bits
[
0
].
length
===
1
)
{
return
'0'
+
bits
[
0
]
+
':00'
;
}
else
{
return
bits
[
0
]
+
':00'
;
}
}
},
// 13:00
{
re
:
/^
\d{2}[
:.
]\d{2}
$/i
,
handler
:
function
(
bits
)
{
return
bits
[
0
].
replace
(
'.'
,
':'
);
}
},
// 9:00
{
re
:
/^
\d[
:.
]\d{2}
$/i
,
handler
:
function
(
bits
)
{
return
'0'
+
bits
[
0
].
replace
(
'.'
,
':'
);
}
},
// 3 am / 3 a.m. / 3am
{
re
:
/^
(\d
+
)\s
*
([
ap
])(?:
.
?
m.
?)?
$/i
,
handler
:
function
(
bits
)
{
var
hour
=
parseInt
(
bits
[
1
]);
if
(
hour
===
12
)
{
hour
=
0
;
}
if
(
bits
[
2
].
toLowerCase
()
===
'p'
)
{
if
(
hour
===
12
)
{
hour
=
0
;
}
return
(
hour
+
12
)
+
':00'
;
}
else
{
if
(
hour
<
10
)
{
return
'0'
+
hour
+
':00'
;
}
else
{
return
hour
+
':00'
;
}
}
}
},
// 3.30 am / 3:15 a.m. / 3.00am
{
re
:
/^
(\d
+
)[
.:
](\d{2})\s
*
([
ap
])
.
?
m.
?
$/i
,
handler
:
function
(
bits
)
{
var
hour
=
parseInt
(
bits
[
1
]);
var
mins
=
parseInt
(
bits
[
2
]);
if
(
mins
<
10
)
{
mins
=
'0'
+
mins
;
}
if
(
hour
===
12
)
{
hour
=
0
;
}
if
(
bits
[
3
].
toLowerCase
()
===
'p'
)
{
if
(
hour
===
12
)
{
hour
=
0
;
}
return
(
hour
+
12
)
+
':'
+
mins
;
}
else
{
if
(
hour
<
10
)
{
return
'0'
+
hour
+
':'
+
mins
;
}
else
{
return
hour
+
':'
+
mins
;
}
}
}
},
// noon
{
re
:
/^no/i
,
handler
:
function
(
bits
)
{
return
'12:00'
;
}
},
// midnight
{
re
:
/^mid/i
,
handler
:
function
(
bits
)
{
return
'00:00'
;
}
}
];
function
parseTimeString
(
s
)
{
for
(
var
i
=
0
;
i
<
timeParsePatterns
.
length
;
i
++
)
{
var
re
=
timeParsePatterns
[
i
].
re
;
var
handler
=
timeParsePatterns
[
i
].
handler
;
var
bits
=
re
.
exec
(
s
);
if
(
bits
)
{
return
handler
(
bits
);
}
}
return
s
;
}
window
.
parseTimeString
=
parseTimeString
;
})();
js_tests/admin/timeparse.test.js
deleted
100644 → 0
Dosyayı görüntüle @
f0f3b302
/* global QUnit, parseTimeString */
/* eslint global-strict: 0, strict: 0 */
'use strict'
;
QUnit
.
module
(
'admin.timeparse'
);
QUnit
.
test
(
'parseTimeString'
,
function
(
assert
)
{
function
time
(
then
,
expected
)
{
assert
.
equal
(
parseTimeString
(
then
),
expected
);
}
time
(
'9'
,
'09:00'
);
time
(
'09'
,
'09:00'
);
time
(
'13:00'
,
'13:00'
);
time
(
'13.00'
,
'13:00'
);
time
(
'9:00'
,
'09:00'
);
time
(
'9.00'
,
'09:00'
);
time
(
'3 am'
,
'03:00'
);
time
(
'3 a.m.'
,
'03:00'
);
time
(
'12 am'
,
'00:00'
);
time
(
'11 am'
,
'11:00'
);
time
(
'12 pm'
,
'12:00'
);
time
(
'3am'
,
'03:00'
);
time
(
'3.30 am'
,
'03:30'
);
time
(
'3:15 a.m.'
,
'03:15'
);
time
(
'3.00am'
,
'03:00'
);
time
(
'12.00am'
,
'00:00'
);
time
(
'11.00am'
,
'11:00'
);
time
(
'12.00pm'
,
'12:00'
);
time
(
'noon'
,
'12:00'
);
time
(
'midnight'
,
'00:00'
);
time
(
'something else'
,
'something else'
);
});
js_tests/tests.html
Dosyayı görüntüle @
d41a1005
...
...
@@ -51,9 +51,6 @@
<script
src=
'../django/contrib/admin/static/admin/js/core.js'
data-cover
></script>
<script
src=
'./admin/core.test.js'
></script>
<script
src=
'../django/contrib/admin/static/admin/js/timeparse.js'
data-cover
></script>
<script
src=
'./admin/timeparse.test.js'
></script>
<script
src=
'../django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js'
data-cover
></script>
<script
src=
'./admin/RelatedObjectLookups.test.js'
></script>
...
...
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