2018-05-29 16:25:29 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2019-03-25 16:55:37 +03:00
|
|
|
'use strict';
|
2018-05-29 16:25:29 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
startOfMinute (date) {
|
2019-03-25 16:55:37 +03:00
|
|
|
const year = date.getUTCFullYear();
|
|
|
|
const month = date.getUTCMonth() + 1;
|
|
|
|
const day = date.getUTCDate();
|
|
|
|
const hour = date.getUTCHours();
|
|
|
|
const minute = date.getUTCMinutes();
|
|
|
|
return `${year}-${pad(month)}-${pad(day)}T${pad(hour)}:${pad(minute)}:00Z`;
|
2018-05-29 16:25:29 +03:00
|
|
|
}
|
2019-03-25 16:55:37 +03:00
|
|
|
};
|
2018-05-29 16:25:29 +03:00
|
|
|
|
|
|
|
function pad (number) {
|
|
|
|
if (number < 10) {
|
2019-03-25 16:55:37 +03:00
|
|
|
return `0${number}`;
|
2018-05-29 16:25:29 +03:00
|
|
|
}
|
|
|
|
|
2019-03-25 16:55:37 +03:00
|
|
|
return number;
|
2018-05-29 16:25:29 +03:00
|
|
|
}
|
|
|
|
|