ISOWeek -7 => date -d -7days +%G-%V

This commit is contained in:
Peter Kleiweg
2026-04-24 12:05:02 +02:00
parent 580a54e11c
commit 5c492f55ff
20 changed files with 17 additions and 71 deletions

1
.gitignore vendored
View File

@@ -34,7 +34,6 @@ VRT/metadata
VRT/vrt
bin/data2json
bin/dates2json
bin/ISOWeek
bin/flush
bin/items2count
bin/score

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -16,7 +16,6 @@ all:
make bin/data2json
make bin/dates2json
make bin/flush
make bin/ISOWeek
make bin/items2count
make bin/score
make bin/top20
@@ -31,9 +30,6 @@ bin/dates2json: cmd/dates2json/*.go
bin/flush: cmd/flush/*.go
go build -o $@ $^
bin/ISOWeek: cmd/ISOWeek/*.go
go build -o $@ $^
bin/items2count: cmd/items2count/*.go
go build -o $@ $^

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -1,48 +0,0 @@
package main
/*
Waarom?
We willen year-week, bijvoorbeeld 2025-52
Als de datum 1 januari 2027 is, dan geeft dit:
date +%Y-%V
... dit:
2027-53
Dat is fout. Het moet zijn:
2026-53
Dit programma geeft wel de juiste uitvoer.
*/
import (
e "codeberg.org/pebbe/errors"
"fmt"
"os"
"strconv"
"time"
)
var (
x = e.ExitErr
)
func main() {
// arg 1: aantal dagen opgeteld bij huidige datum
d, err := strconv.Atoi(os.Args[1])
x(err)
location, err := time.LoadLocation("Europe/Amsterdam")
x(err)
year, week := time.Now().AddDate(0, 0, d).In(location).ISOWeek()
fmt.Printf("%d-%02d\n", year, week)
}

View File

@@ -26,7 +26,7 @@ var (
func main() {
files, err := os.ReadDir("/net/corpora/nlnieuws/data")
files, err := os.ReadDir("/net/corpora/nlnieuws/data/json")
x(err)
for _, file := range files {

View File

@@ -155,6 +155,6 @@ do
done
done
data2json $ds 1 > DATA-$ds-1.json
data2json $ds 4 > DATA-$ds-4.json
data2json $ds 1 > json/DATA-$ds-1.json
data2json $ds 4 > json/DATA-$ds-4.json

View File

@@ -13,7 +13,6 @@
<body>
<div class="title">
<h1>Woord van de maand</h1>
<p>terugkijkend over vier weken</p>
</div>
<div class="form">
<form name="choice">

View File

@@ -13,7 +13,7 @@ fi
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])

View File

@@ -8,7 +8,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISOWeek -7`
ds=`date -d -7days +%G-%V`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])