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
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
year = slice date 0 4;
month = slice date 4 2;
day = slice date 6 2;
hour = slice date 8 2;
minute = slice date 10 2;
second = slice date 12 2;
year = substring 0 4 date;
month = substring 4 2 date;
day = substring 6 2 date;
hour = substring 8 2 date;
minute = substring 10 2 date;
second = substring 12 2 date;
in
"${year}-${month}-${day} ${hour}:${minute}:${second} UTC";
in