ISOWeek -7 => date -d -7days +%G-%V
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -34,7 +34,6 @@ VRT/metadata
|
|||||||
VRT/vrt
|
VRT/vrt
|
||||||
bin/data2json
|
bin/data2json
|
||||||
bin/dates2json
|
bin/dates2json
|
||||||
bin/ISOWeek
|
|
||||||
bin/flush
|
bin/flush
|
||||||
bin/items2count
|
bin/items2count
|
||||||
bin/score
|
bin/score
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -16,7 +16,6 @@ all:
|
|||||||
make bin/data2json
|
make bin/data2json
|
||||||
make bin/dates2json
|
make bin/dates2json
|
||||||
make bin/flush
|
make bin/flush
|
||||||
make bin/ISOWeek
|
|
||||||
make bin/items2count
|
make bin/items2count
|
||||||
make bin/score
|
make bin/score
|
||||||
make bin/top20
|
make bin/top20
|
||||||
@@ -31,9 +30,6 @@ bin/dates2json: cmd/dates2json/*.go
|
|||||||
bin/flush: cmd/flush/*.go
|
bin/flush: cmd/flush/*.go
|
||||||
go build -o $@ $^
|
go build -o $@ $^
|
||||||
|
|
||||||
bin/ISOWeek: cmd/ISOWeek/*.go
|
|
||||||
go build -o $@ $^
|
|
||||||
|
|
||||||
bin/items2count: cmd/items2count/*.go
|
bin/items2count: cmd/items2count/*.go
|
||||||
go build -o $@ $^
|
go build -o $@ $^
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -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)
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,7 @@ var (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
files, err := os.ReadDir("/net/corpora/nlnieuws/data")
|
files, err := os.ReadDir("/net/corpora/nlnieuws/data/json")
|
||||||
x(err)
|
x(err)
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
|||||||
@@ -155,6 +155,6 @@ do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
data2json $ds 1 > DATA-$ds-1.json
|
data2json $ds 1 > json/DATA-$ds-1.json
|
||||||
data2json $ds 4 > DATA-$ds-4.json
|
data2json $ds 4 > json/DATA-$ds-4.json
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h1>Woord van de maand</h1>
|
<h1>Woord van de maand</h1>
|
||||||
<p>terugkijkend over vier weken</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<form name="choice">
|
<form name="choice">
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ fi
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export TZ=Europe/Amsterdam
|
|||||||
|
|
||||||
if [ "$1" = "" ]
|
if [ "$1" = "" ]
|
||||||
then
|
then
|
||||||
ds=`ISOWeek -7`
|
ds=`date -d -7days +%G-%V`
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
2[0-9][0-9][0-9]-[0-5][0-9])
|
2[0-9][0-9][0-9]-[0-5][0-9])
|
||||||
|
|||||||
Reference in New Issue
Block a user