modules/buildinfo: simplify implementation

turns out there is a string-slicing function, I just overlooked it when
writing this file (it's even a builtin). So let's use that instead.
This commit is contained in:
stuebinm 2024-04-19 03:38:50 +02:00
parent 208bcaa898
commit 3dc63acf52

View file

@ -2,20 +2,15 @@
let let
self = sources.self; self = sources.self;
slice = string: start: length: with lib;
strings.concatStrings
(lists.take length
(lists.drop start
(strings.stringToCharacters string)));
formatDate = date: formatDate = date: with lib.strings;
let let
year = slice date 0 4; year = substring 0 4 date;
month = slice date 4 2; month = substring 4 2 date;
day = slice date 6 2; day = substring 6 2 date;
hour = slice date 8 2; hour = substring 8 2 date;
minute = slice date 10 2; minute = substring 10 2 date;
second = slice date 12 2; second = substring 12 2 date;
in in
"${year}-${month}-${day} ${hour}:${minute}:${second} UTC"; "${year}-${month}-${day} ${hour}:${minute}:${second} UTC";
in in