Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
WeatherAPI
Project
Project
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
1
Merge Requests
1
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
Ly Trịnh Khánh
WeatherAPI
Commits
ec080999
Commit
ec080999
authored
May 04, 2023
by
DangSauQuaKhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deploy
parent
62ae7da0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
11 deletions
+28
-11
index.html
docs/index.html
+1
-1
main.807a221f2c796e58.js
docs/main.807a221f2c796e58.js
+1
-1
today.component.html
src/app/today/today.component.html
+2
-1
today.component.scss
src/app/today/today.component.scss
+7
-6
today.component.ts
src/app/today/today.component.ts
+17
-2
No files found.
docs/index.html
View file @
ec080999
...
...
@@ -8,6 +8,6 @@
<style>
@charset
"UTF-8"
;
:root
{
--bs-blue
:
#0d6efd
;
--bs-indigo
:
#6610f2
;
--bs-purple
:
#6f42c1
;
--bs-pink
:
#d63384
;
--bs-red
:
#dc3545
;
--bs-orange
:
#fd7e14
;
--bs-yellow
:
#ffc107
;
--bs-green
:
#198754
;
--bs-teal
:
#20c997
;
--bs-cyan
:
#0dcaf0
;
--bs-black
:
#000
;
--bs-white
:
#fff
;
--bs-gray
:
#6c757d
;
--bs-gray-dark
:
#343a40
;
--bs-gray-100
:
#f8f9fa
;
--bs-gray-200
:
#e9ecef
;
--bs-gray-300
:
#dee2e6
;
--bs-gray-400
:
#ced4da
;
--bs-gray-500
:
#adb5bd
;
--bs-gray-600
:
#6c757d
;
--bs-gray-700
:
#495057
;
--bs-gray-800
:
#343a40
;
--bs-gray-900
:
#212529
;
--bs-primary
:
#0d6efd
;
--bs-secondary
:
#6c757d
;
--bs-success
:
#198754
;
--bs-info
:
#0dcaf0
;
--bs-warning
:
#ffc107
;
--bs-danger
:
#dc3545
;
--bs-light
:
#f8f9fa
;
--bs-dark
:
#212529
;
--bs-primary-rgb
:
13
,
110
,
253
;
--bs-secondary-rgb
:
108
,
117
,
125
;
--bs-success-rgb
:
25
,
135
,
84
;
--bs-info-rgb
:
13
,
202
,
240
;
--bs-warning-rgb
:
255
,
193
,
7
;
--bs-danger-rgb
:
220
,
53
,
69
;
--bs-light-rgb
:
248
,
249
,
250
;
--bs-dark-rgb
:
33
,
37
,
41
;
--bs-white-rgb
:
255
,
255
,
255
;
--bs-black-rgb
:
0
,
0
,
0
;
--bs-body-color-rgb
:
33
,
37
,
41
;
--bs-body-bg-rgb
:
255
,
255
,
255
;
--bs-font-sans-serif
:
system-ui
,
-apple-system
,
"Segoe UI"
,
Roboto
,
"Helvetica Neue"
,
"Noto Sans"
,
"Liberation Sans"
,
Arial
,
sans-serif
,
"Apple Color Emoji"
,
"Segoe UI Emoji"
,
"Segoe UI Symbol"
,
"Noto Color Emoji"
;
--bs-font-monospace
:
SFMono-Regular
,
Menlo
,
Monaco
,
Consolas
,
"Liberation Mono"
,
"Courier New"
,
monospace
;
--bs-gradient
:
linear-gradient
(
180deg
,
rgba
(
255
,
255
,
255
,
.15
),
rgba
(
255
,
255
,
255
,
0
));
--bs-body-font-family
:
var
(
--bs-font-sans-serif
);
--bs-body-font-size
:
1rem
;
--bs-body-font-weight
:
400
;
--bs-body-line-height
:
1.5
;
--bs-body-color
:
#212529
;
--bs-body-bg
:
#fff
;
--bs-border-width
:
1px
;
--bs-border-style
:
solid
;
--bs-border-color
:
#dee2e6
;
--bs-border-color-translucent
:
rgba
(
0
,
0
,
0
,
.175
);
--bs-border-radius
:
.375rem
;
--bs-border-radius-sm
:
.25rem
;
--bs-border-radius-lg
:
.5rem
;
--bs-border-radius-xl
:
1rem
;
--bs-border-radius-2xl
:
2rem
;
--bs-border-radius-pill
:
50rem
;
--bs-link-color
:
#0d6efd
;
--bs-link-hover-color
:
#0a58ca
;
--bs-code-color
:
#d63384
;
--bs-highlight-bg
:
#fff3cd
}
*,
:after
,
:before
{
box-sizing
:
border-box
}
@media
(
prefers-reduced-motion
:
no-preference
){
:root
{
scroll-behavior
:
smooth
}}
body
{
margin
:
0
;
font-family
:
var
(
--bs-body-font-family
);
font-size
:
var
(
--bs-body-font-size
);
font-weight
:
var
(
--bs-body-font-weight
);
line-height
:
var
(
--bs-body-line-height
);
color
:
var
(
--bs-body-color
);
text-align
:
var
(
--bs-body-text-align
);
background-color
:
var
(
--bs-body-bg
);
-webkit-text-size-adjust
:
100%
;
-webkit-tap-highlight-color
:
transparent
}
</style><link
rel=
"stylesheet"
href=
"styles.1a8208b7ca9a3fa2.css"
media=
"print"
onload=
"this.media='all'"
><noscript><link
rel=
"stylesheet"
href=
"styles.1a8208b7ca9a3fa2.css"
></noscript></head>
<body>
<app-root></app-root>
<script
src=
"runtime.fa2c139a589fcb01.js"
type=
"module"
></script><script
src=
"polyfills.a277350f6f1b17a3.js"
type=
"module"
></script><script
src=
"main.
d5d4ff0935ced84d
.js"
type=
"module"
></script>
<script
src=
"runtime.fa2c139a589fcb01.js"
type=
"module"
></script><script
src=
"polyfills.a277350f6f1b17a3.js"
type=
"module"
></script><script
src=
"main.
807a221f2c796e58
.js"
type=
"module"
></script>
</body></html>
\ No newline at end of file
docs/main.
d5d4ff0935ced84d
.js
→
docs/main.
807a221f2c796e58
.js
View file @
ec080999
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/app/today/today.component.html
View file @
ec080999
...
...
@@ -30,6 +30,7 @@
</div>
</div>
<div
class=
"date text-center"
>
{{item.date | date:'mediumDate'}}
</div>
</article>
</a>
</div>
...
...
@@ -45,7 +46,7 @@
<div
class=
"place"
>
{{cities[i + 1].name}}, {{cities[i + 1].sys.country}}
</div>
</div>
</div>
<div
class=
"date text-center"
>
{{cities[i + 1].date
| date:'mediumDate'
}}
</div>
<div
class=
"date text-center"
>
{{cities[i + 1].date
| date:'mediumDate'
}}
</div>
</article>
</a>
</div>
...
...
src/app/today/today.component.scss
View file @
ec080999
...
...
@@ -47,10 +47,10 @@ body {
color
:
white
;
.temperature
{
flex
:
0
0
20
%
;
flex
:
0
0
15
%
;
width
:
50%
;
margin-right
:
1
5px
;
font-size
:
20
px
;
padding-right
:
5px
;
font-size
:
15
px
;
display
:
flex
;
justify-content
:
space-around
;
margin-right
:
10px
;
...
...
@@ -59,21 +59,22 @@ body {
}
.description
{
flex
:
0
6
0
%
;
flex
:
0
6
5
%
;
display
:
flex
;
flex-direction
:
column
;
width
:
100%
;
height
:
100%
;
justify-content
:
center
;
padding
:
5px
5px
5px
5px
;
.weatherCondition
{
text-transform
:
uppercase
;
font-size
:
1
4
px
;
font-size
:
1
5
px
;
font-weight
:
800
;
}
.place
{
font-size
:
1
5
px
;
font-size
:
1
4
px
;
}
}
}
...
...
src/app/today/today.component.ts
View file @
ec080999
...
...
@@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
import
{
WeatherService
}
from
'
../weather.service
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
Swal
from
'
sweetalert2
'
;
import
{
Parser
}
from
'
@angular/compiler
'
;
@
Component
({
selector
:
'
app-today
'
,
templateUrl
:
'
./today.component.html
'
,
...
...
@@ -25,7 +26,14 @@ export class TodayComponent implements OnInit {
this
.
weatherService
.
getWeatherDataByCoords
(
this
.
lat
,
this
.
lon
).
subscribe
(
data
=>
{
this
.
weather
=
data
;
this
.
weather
.
date
=
new
Date
();
const
utc_seconds
=
parseInt
(
this
.
weather
.
dt
,
10
)
+
parseInt
(
this
.
weather
.
timezone
,
10
);
let
utc_milliseconds
=
utc_seconds
*
1000
;
let
date
=
new
Date
(
utc_milliseconds
);
let
hour
=
date
.
getUTCHours
();
if
(
hour
>=
12
)
utc_milliseconds
=
(
utc_seconds
-
24
*
60
*
60
)
*
1000
;
let
local_date
=
new
Date
(
utc_milliseconds
).
toUTCString
();
console
.
log
(
local_date
);
this
.
weather
.
date
=
local_date
;
let
tempC
=
((
parseFloat
(
this
.
weather
.
main
.
temp
)
-
32
)
/
1.8
).
toFixed
(
1
);
if
(
parseFloat
(
tempC
)
==
parseInt
(
tempC
))
this
.
weather
.
main
.
tempC
=
parseInt
(
tempC
);
else
{
...
...
@@ -52,7 +60,14 @@ export class TodayComponent implements OnInit {
next
:
data
=>
{
this
.
weather
=
data
;
console
.
log
(
this
.
weather
);
this
.
weather
.
date
=
new
Date
();
const
utc_seconds
=
parseInt
(
this
.
weather
.
dt
,
10
)
+
parseInt
(
this
.
weather
.
timezone
,
10
);
let
utc_milliseconds
=
utc_seconds
*
1000
;
let
date
=
new
Date
(
utc_milliseconds
);
let
hour
=
date
.
getUTCHours
();
if
(
hour
>=
12
)
utc_milliseconds
=
(
utc_seconds
-
24
*
60
*
60
)
*
1000
;
let
local_date
=
new
Date
(
utc_milliseconds
).
toUTCString
();
console
.
log
(
local_date
);
this
.
weather
.
date
=
local_date
;
let
tempC
=
((
parseFloat
(
this
.
weather
.
main
.
temp
)
-
32
)
/
1.8
).
toFixed
(
1
);
if
(
parseFloat
(
tempC
)
==
parseInt
(
tempC
))
this
.
weather
.
main
.
tempC
=
parseInt
(
tempC
);
else
{
...
...
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