@per-diem-calculator/vanilla 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -10
- package/dist/index.js +1849 -1714
- package/dist/index.umd.cjs +178 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Introduction
|
|
2
2
|
|
|
3
|
-
This is an open source per diem calculator to
|
|
3
|
+
This is an open source per diem calculator to lookup lodging and meals per diem rates, and account for deductions, for both domestic and international trips. A demo can be found here: https://perdiemcalc.org.
|
|
4
4
|
|
|
5
5
|
There are a few issues with the tools available as of May 2025:
|
|
6
6
|
|
|
@@ -11,9 +11,9 @@ There are a few issues with the tools available as of May 2025:
|
|
|
11
11
|
|
|
12
12
|
This calculator was built to address all the above issues. It's a single tool that:
|
|
13
13
|
|
|
14
|
-
- Pulls both domestic and international rates
|
|
15
|
-
- Accounts for multi-destination trips
|
|
14
|
+
- Pulls both domestic and international rates, and provides the ability to select deductions for each rate
|
|
16
15
|
- Gets rates directly from federal sources via GSA's API; and via downloading OCONUS rate zip files from the Dept. of Defense (which includes the State Department's OCONUS rates), unpacking them using JSZIP, and parsing the rate XML file using DOMParser and XPathEvaluator
|
|
16
|
+
- Accounts for multi-destination trips
|
|
17
17
|
- Easily incorporates into existing projects by being built with native Javascript web components
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
@@ -48,7 +48,7 @@ const container = document.querySelector('#perDiemCalc');
|
|
|
48
48
|
new Pdc(container);
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
The expenses can be outputted to an object for further use in your application (see your console in [this demo](https://perdiemcalc.org/object) and
|
|
51
|
+
The rates and expenses can be outputted to an object for further use in your application (see your console in [this demo](https://perdiemcalc.org/object), and the [Expense Object](#expense-object) and [Rates Object](#rates-object) sections):
|
|
52
52
|
|
|
53
53
|
```
|
|
54
54
|
import { Pdc } from '@per-diem-calculator/vanilla';
|
|
@@ -58,8 +58,9 @@ const container = document.querySelector('#perDiemCalc');
|
|
|
58
58
|
const pdc = new Pdc(container);
|
|
59
59
|
|
|
60
60
|
pdc.addEventListener('expenseUpdate', e => {
|
|
61
|
-
const {
|
|
62
|
-
console.table(
|
|
61
|
+
const { expenses, rates } = e.detail;
|
|
62
|
+
console.table(expenses);
|
|
63
|
+
console.table(rates);
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
```
|
|
@@ -76,8 +77,8 @@ pdc.addEventListener('expenseUpdate', e => {
|
|
|
76
77
|
```
|
|
77
78
|
{
|
|
78
79
|
date: "2025-05-27",
|
|
79
|
-
country: "AR" // for domestic rates, states are counted as countries
|
|
80
|
-
city: "Hot Springs"
|
|
80
|
+
country: "AR", // for domestic rates, states are counted as countries
|
|
81
|
+
city: "Hot Springs",
|
|
81
82
|
deductions: {
|
|
82
83
|
FirstLastDay: true,
|
|
83
84
|
breakfastProvided: true,
|
|
@@ -101,19 +102,35 @@ pdc.addEventListener('expenseUpdate', e => {
|
|
|
101
102
|
}
|
|
102
103
|
```
|
|
103
104
|
|
|
105
|
+
## Rates Object
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
{
|
|
109
|
+
eff_date: "05/2025",
|
|
110
|
+
location: "Hotsprings, AR",
|
|
111
|
+
maxLodging: 114,
|
|
112
|
+
maxMie: 68,
|
|
113
|
+
maxMieFirstLast: 51,
|
|
114
|
+
maxIncidental: 5,
|
|
115
|
+
deductionBreakfast: 16,
|
|
116
|
+
deductionLunch: 19,
|
|
117
|
+
deductionDinner: 28,
|
|
118
|
+
source: "https://www.gsa.gov/travel/plan-book/per-diem-rates/per-diem-rates-results?action=perdiems_report&fiscal_year=2025&state=AR&city=Hot Springs"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
104
122
|
## Built With
|
|
105
123
|
|
|
106
124
|
- TypeScript
|
|
107
125
|
- Tailwind
|
|
108
126
|
- [Tom Select](https://github.com/orchidjs/tom-select) ([Apache-2.0](https://github.com/orchidjs/tom-select?tab=Apache-2.0-1-ov-file)) for searchable dropdowns
|
|
109
127
|
- [JSZip](https://github.com/Stuk/jszip) ([MIT](https://github.com/Stuk/jszip?tab=License-1-ov-file)) to unpack DOD rate zip files
|
|
110
|
-
- [DOMPurify](https://github.com/cure53/DOMPurify) ([Apache-2.0](https://github.com/cure53/DOMPurify?tab=License-1-ov-file)) to
|
|
128
|
+
- [DOMPurify](https://github.com/cure53/DOMPurify) ([Apache-2.0](https://github.com/cure53/DOMPurify?tab=License-1-ov-file)) to sanitize config options
|
|
111
129
|
|
|
112
130
|
## Planned Updates
|
|
113
131
|
|
|
114
132
|
- Accessibility improvements to reach full WCAG compliance
|
|
115
133
|
- CSS paths for an easy way to style shadowDOM elements
|
|
116
|
-
- Option to display rates onscreen vs just in the generated PDF
|
|
117
134
|
- Option to mark personal days and remove them from the final expense amount
|
|
118
135
|
- React version - I used this project as a way to get familiar with native web components, but a React version will be shared soon
|
|
119
136
|
- CDN option
|