Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma strängvärde byggs med konkatenering i stället för att matcha mönstret.
27 lines
985 B
TypeScript
27 lines
985 B
TypeScript
/**
|
|
* Field formatters shared by the SRU generators (INK2 and NE-bilaga). SRU is a
|
|
* Skatteverket line format: dates are YYYYMMDD, times HHMMSS, amounts are hela
|
|
* kronor with the öre truncated and no separators.
|
|
*/
|
|
|
|
/** Format a Date as YYYYMMDD (local time, as the files are stamped on the user's clock). */
|
|
export function sruDate(date: Date): string {
|
|
const y = date.getFullYear()
|
|
const m = String(date.getMonth() + 1).padStart(2, '0')
|
|
const d = String(date.getDate()).padStart(2, '0')
|
|
return `${y}${m}${d}`
|
|
}
|
|
|
|
/** Format a Date as HHMMSS. */
|
|
export function sruTime(date: Date): string {
|
|
const h = String(date.getHours()).padStart(2, '0')
|
|
const m = String(date.getMinutes()).padStart(2, '0')
|
|
const s = String(date.getSeconds()).padStart(2, '0')
|
|
return `${h}${m}${s}`
|
|
}
|
|
|
|
/** Format an integer amount: hela kronor, no decimals/thousands separators, öre truncated. */
|
|
export function sruAmount(amount: number): string {
|
|
return Math.trunc(amount).toString()
|
|
}
|