bare-script 2.2.12 → 2.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/library.js +6 -2
  2. package/package.json +1 -1
package/lib/library.js CHANGED
@@ -278,9 +278,13 @@ export const scriptFunctions = {
278
278
  'datetimeISOFormat': ([datetime, isDate = false]) => {
279
279
  let result = null;
280
280
  if (datetime instanceof Date) {
281
- result = datetime.toISOString();
282
281
  if (isDate) {
283
- result = result.slice(0, result.indexOf('T'));
282
+ const year = datetime.getFullYear();
283
+ const month = datetime.getMonth() + 1;
284
+ const day = datetime.getDate();
285
+ result = `${year}-${month < 10 ? '0' : ''}${month}-${day < 10 ? '0' : ''}${day}`;
286
+ } else {
287
+ result = datetime.toISOString();
284
288
  }
285
289
  }
286
290
  return result;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bare-script",
4
- "version": "2.2.12",
4
+ "version": "2.2.13",
5
5
  "description": "BareScript; a lightweight scripting and expression language",
6
6
  "keywords": [
7
7
  "expression",