mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
Fixed clock module sunrise/sunset timezone bug (#3070)
Updated sunrise/sunset times to display user-requested timezone rather than system timezone. Note: rebase of #3069 against develop rather than master Co-authored-by: Veeck <github@veeck.de>
This commit is contained in:
parent
09f117c3d9
commit
dee3cd3da7
@ -152,7 +152,7 @@ const formatTime = (config, time) => {
|
|||||||
let date = moment(time);
|
let date = moment(time);
|
||||||
|
|
||||||
if (config.timezone) {
|
if (config.timezone) {
|
||||||
date = moment.tz(config.timezone);
|
date = date.tz(config.timezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.timeFormat !== 24) {
|
if (config.timeFormat !== 24) {
|
||||||
|
@ -114,24 +114,11 @@ describe("Default modules utils tests", () => {
|
|||||||
describe("formatTime", () => {
|
describe("formatTime", () => {
|
||||||
const time = new Date();
|
const time = new Date();
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
jest.useFakeTimers();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
jest.setSystemTime(new Date("2023-01-01 13:13"));
|
time.setHours(13, 13);
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
jest.setSystemTime(new Date());
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
jest.useRealTimers();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should convert correctly according to the config", () => {
|
it("should convert correctly according to the config", () => {
|
||||||
time.setHours(13, 13);
|
|
||||||
expect(
|
expect(
|
||||||
formatTime(
|
formatTime(
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user