testowania w konsoli węzła:moment.js - UTC nie działa jak mam się go spodziewać
var moment = require('moment');
// create a new Date-Object
var now = new Date(2013, 02, 28, 11, 11, 11);
// create the native timestamp
var native = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
// create the timestamp with moment
var withMoment = moment.utc(now).valueOf()
// it doesnt matter if i use moment(now).utc().valueOf() or moment().utc(now).valueOf()
// native: 1364469071000
// withMoment: 1364465471000
native === withMoment // false!?!?!
// this returns true!!!
withMoment === now.getTime()
dlaczego isnt natywną ten sam znacznik czasu jako withMoment? dlaczego withMoment zwraca znacznik czasu obliczony z bieżącego czasu lokalnego? jak mogę osiągnąć ten moment.utc() zwraca to samo co Date.UTC()?
już wypróbował to i zobaczył, że to działa. czy to jedyna opcja, którą mam? think moment.js zapisuje mi kod i czas ;-( – hereandnow78
Możesz przekazać 'native' do' chwili.utc() 'zamiast' teraz', to też zadziała. – robertklep
Tak, nadal nie to, co chciałem, ale ty ;-) – hereandnow78