-
Notifications
You must be signed in to change notification settings - Fork 0
/
converter.html
167 lines (162 loc) · 4.32 KB
/
converter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
title: Free Weekly/Monthly Rental Rate Calculator
description: Quickly convert between PCM and PW with this free interactive calculator tool.
permalink: weekly-monthly-rental-rate-converter/
comments: true
social: true
socialImg: assets/social/converter.png
featPosts: ["iss","creaturesOfTheDeep","dogenerator"]
---
{% include header.html %}
<style>
.postHeader {
text-align:center;
font-size:30px;
max-width: 500px;
margin: 1em auto 2em;
}
.post {
text-align: center;
}
#converter {
margin:0 auto;
}
@media screen and (min-width: 300px){
#converter div {
display: inline-block;
width: 40%;
vertical-align: top;
}
}
.c_input {
border:6px solid #006694;
border-radius:12px;
padding:7px;
font-size:15px;
font-weight:bold;
box-shadow:inset 0 1px 10px #bbb;
background:#fafafa;
width:100%;
color:#666;
text-align: center;
}
.c_input:focus {
background:#fff;
box-shadow:inset 0 1px 10px #ccc;
color:#333;
outline:none;
}
.c_input.inputError {
color:#a04545;
background: #fee;
}
::-webkit-input-placeholder {
color: #a04545;
}
:-moz-placeholder {
color: #a04545;
}
::-moz-placeholder {
color: #a04545;
}
:-ms-input-placeholder {
color: #a04545;
}
#converter label {
clear:both;
background:#006694;
padding:2px 0 7px;
color:#fff;
border-radius:0 0 12px 12px;
font-size:11px;
text-transform:uppercase;
font-weight:bold;
display:block;
margin:0 auto;
width:90px;
}
#converter #equals {
font-size:25px;
font-weight:bold;
margin:0;
padding:2px 15px;
display: inline-block;
vertical-align: top;
}
.postContent {
max-width: 550px;
margin: 4em auto;
}
h4 {
font-size: 1.2em;
margin: 3em 0 0;
}
.postContent strong {
display: block;
font-family: monospace;
font-size: 1.2em;
margin: 0.5em 0;
}
</style>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-5334550093857056",
enable_page_level_ads: true
});
</script>
</head>
<body class="grey">
{% include nav.html %}
<main class="wrapper base">
<article class="post">
<h2 class="postHeader">Convert between weekly rate and monthly rate</h2>
<form id="converter" class="clearfix">
<div>
<input id="week" class="c_input" type="number" />
<label for="week">Per week</label>
</div>
<p id="equals"> = </p>
<div>
<input id="month" class="c_input" type="number" />
<label for="month">Per month</label>
</div>
</form>
<div class="postContent">
<p>Easily convert between rent per calendar month and rent per week. Enter your current rate in the appropriate text input and the other box will instantly show the corresponding value.</p>
<h4>How the calculation is made</h4>
<p>There are <a href="http://www.tenantsact.org.au/FAQRetrieve.aspx?ID=36382" target="_blank">several different ways</a> to convert between pw and pcm values. This calculator uses the following formula: <strong>PW = PCM × 12 / 365.25 × 7</strong> This means that to get the rental rate per week, the monthly value is multiplied by 12 to get the rent per year, then divided by 365.25 (the average number of days in a year, including leap years) to get the daily value, then multiplied by 7. To convert back into months, the reverse operation is applied.</p>
</div>
<p class="meta">Published 25 October 2011</p>
</article>
</main>
{% include footerJS.html %}
<script>
$(function() {
$("#converter input").on('keyup change',function() {
function rnd(n){
return Math.round(n*100)/100;
}
function convert(n,toWeek){
return toWeek ? ((n*12)/365.25)*7 : ((n/7)*365.25)/12;
}
var inputID = $(this).attr('id'),
val = $(this).val(),
nan = val.length<1 || isNaN(val), // true if Not a Number
toWeek = inputID === 'month', // true if converting month->week
newVal = rnd( convert(val, toWeek) );
$("#converter input")
.toggleClass('inputError',nan)
.not('#'+inputID)
.val(function(){
return nan ? null : newVal;
})
.attr('placeholder',function(){
return nan ? 'Please enter a number' : null;
});
}).on('click',function(){
$(this).select();
});
});
</script>
{% include footer.html %}